Add linting for copyright and unused usings (#1416)

* Add linting for copyright and unused usings

* Add one more + comment

* Enforce in build and fix errors

* Fix build
This commit is contained in:
Charles Gagnon
2022-03-04 15:17:29 -08:00
committed by GitHub
parent 025f9af4fd
commit c248400a6c
233 changed files with 1323 additions and 364 deletions

345
.editorconfig Normal file
View File

@@ -0,0 +1,345 @@
# See https://github.com/dotnet/roslyn-analyzers/blob/main/.editorconfig for an example on different settings and how they're used
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# Autogenerated string files, don't enforce certain styles on them
[sr.cs]
dotnet_diagnostic.IDE0005.severity = none
dotnet_diagnostic.IDE0073.severity = none
# C# files
[*.cs]
dotnet_analyzer_diagnostic.severity = error
# Errors flagged when this file was added. These should be
# investigated and either fixed or marked as acceptable with
# a reason why
dotnet_diagnostic.IDE0018.severity = none
dotnet_diagnostic.CA1829.severity = none
dotnet_diagnostic.CA1806.severity = none
dotnet_diagnostic.IDE0078.severity = none
dotnet_diagnostic.IDE0019.severity = none
dotnet_diagnostic.CA1309.severity = none
dotnet_diagnostic.CA2249.severity = none
dotnet_diagnostic.CA2251.severity = none
dotnet_diagnostic.CA1310.severity = none
dotnet_diagnostic.CA1305.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.IDE0009.severity = none
dotnet_diagnostic.IDE0045.severity = none
dotnet_diagnostic.CA1304.severity = none
dotnet_diagnostic.IDE0002.severity = none
dotnet_diagnostic.CA2208.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0047.severity = none
dotnet_diagnostic.IDE0051.severity = none
dotnet_diagnostic.IDE1000.severity = none
dotnet_diagnostic.CA1834.severity = none
dotnet_diagnostic.IDE0066.severity = none
dotnet_diagnostic.IDE0007.severity = none
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0044.severity = none
dotnet_diagnostic.IDE0057.severity = none
dotnet_diagnostic.CA2101.severity = none
dotnet_diagnostic.CA1068.severity = none
dotnet_diagnostic.CA1069.severity = none
dotnet_diagnostic.IDE0059.severity = none
dotnet_diagnostic.CA1010.severity = none
dotnet_diagnostic.CA1001.severity = none
dotnet_diagnostic.CA1036.severity = none
dotnet_diagnostic.CA5369.severity = none
dotnet_diagnostic.CA2245.severity = none
dotnet_diagnostic.CA1507.severity = none
dotnet_diagnostic.CA1845.severity = none
dotnet_diagnostic.IDE0025.severity = none
dotnet_diagnostic.xUnit2000.severity = none
dotnet_diagnostic.xUnit2012.severity = none
dotnet_diagnostic.xUnit1013.severity = none
dotnet_diagnostic.CA1711.severity = none
dotnet_diagnostic.IDE0027.severity = none
dotnet_diagnostic.IDE0021.severity = none
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.CA2201.severity = none
dotnet_diagnostic.CA1051.severity = none
dotnet_diagnostic.IDE0004.severity = none
dotnet_diagnostic.CA1838.severity = none
dotnet_diagnostic.IDE0075.severity = none
dotnet_diagnostic.CA1825.severity = none
dotnet_diagnostic.CA1816.severity = none
dotnet_diagnostic.CA1827.severity = none
dotnet_diagnostic.CA1720.severity = none
dotnet_diagnostic.CA1805.severity = none
dotnet_diagnostic.CA1725.severity = none
dotnet_diagnostic.CA2231.severity = none
dotnet_diagnostic.CA2016.severity = none
dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.CA1835.severity = none
dotnet_diagnostic.CA1716.severity = none
dotnet_diagnostic.CA1708.severity = none
dotnet_diagnostic.CA1000.severity = none
dotnet_diagnostic.CA2211.severity = none
dotnet_diagnostic.CA1041.severity = none
dotnet_diagnostic.CA1715.severity = none
dotnet_diagnostic.IDE1006.severity = none
dotnet_diagnostic.CA1846.severity = none
dotnet_diagnostic.CA1847.severity = none
dotnet_diagnostic.CA1018.severity = none
dotnet_diagnostic.IDE0100.severity = none
dotnet_diagnostic.IDE0022.severity = none
dotnet_diagnostic.CA1841.severity = none
dotnet_diagnostic.CA2241.severity = none
dotnet_diagnostic.CA1436.severity = none
dotnet_diagnostic.CA2200.severity = none
dotnet_diagnostic.CA1836.severity = none
dotnet_diagnostic.IDE0028.severity = none
dotnet_diagnostic.IDE0032.severity = none
dotnet_diagnostic.IDE0065.severity = none
dotnet_diagnostic.IDE0120.severity = none
dotnet_diagnostic.IDE0130.severity = none
dotnet_diagnostic.IDE0017.severity = none
dotnet_diagnostic.IDE0010.severity = none
dotnet_diagnostic.IDE0052.severity = none
dotnet_diagnostic.IDE1005.severity = none
dotnet_diagnostic.IDE0040.severity = none
dotnet_diagnostic.IDE0034.severity = none
dotnet_diagnostic.IDE0063.severity = none
dotnet_diagnostic.IDE0049.severity = none
dotnet_diagnostic.IDE0001.severity = none
dotnet_diagnostic.IDE0039.severity = none
dotnet_diagnostic.IDE0054.severity = none
dotnet_diagnostic.IDE0060.severity = none
dotnet_diagnostic.IDE0048.severity = none
dotnet_diagnostic.IDE0030.severity = none
dotnet_diagnostic.IDE0031.severity = none
dotnet_diagnostic.IDE0016.severity = none
dotnet_diagnostic.IDE0036.severity = none
dotnet_diagnostic.IDE0029.severity = none
dotnet_diagnostic.IDE0076.severity = none
dotnet_diagnostic.IDE0070.severity = none
dotnet_diagnostic.IDE0011.severity = none
dotnet_diagnostic.IDE0056.severity = none
dotnet_diagnostic.IDE0082.severity = none
dotnet_diagnostic.IDE0071.severity = none
dotnet_diagnostic.IDE0083.severity = none
dotnet_diagnostic.IDE0041.severity = none
dotnet_diagnostic.IDE0150.severity = none
dotnet_diagnostic.IDE0020.severity = none
dotnet_diagnostic.IDE0061.severity = none
dotnet_diagnostic.IDE0062.severity = none
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
file_header_template = \nCopyright (c) Microsoft. All rights reserved.\nLicensed under the MIT license. See LICENSE file in the project root for full license information.\n
# this. and Me. preferences
dotnet_style_qualification_for_event = true
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_method = true
dotnet_style_qualification_for_property = true
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true
# Parameter preferences
dotnet_code_quality_unused_parameters = all : error
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = true
dotnet_style_allow_statement_immediately_after_block_experimental = true
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = true
# Expression-bodied members
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = true
# Null-checking preferences
csharp_style_conditional_delegate_call = true
# Modifier preferences
csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_inlined_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_range_operator = true
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
# Disable IDE0058 since it causes a lot of noise/suppressions which doesn't seem worth it to have currently
dotnet_diagnostic.IDE0058.severity = silent
# csharp_style_unused_value_expression_statement_preference = discard_variable
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

View File

@@ -9,5 +9,6 @@
<ServiceLayerTargetFramework>net6.0</ServiceLayerTargetFramework>
<ResourceProviderTargetFramework>net6.0</ResourceProviderTargetFramework>
<ToolsServiceTargetRuntimes>win-x64;win-x86;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;osx.10.11-x64;osx-x64;linux-x64</ToolsServiceTargetRuntimes>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
</Project>

View File

@@ -230,7 +230,7 @@ Task("BuildTest")
StandardOutputWriter = logWriter,
StandardErrorWriter = logWriter
})
.ExceptionOnError($"Building test {project} failed for {framework}.");
.ExceptionOnError($"Building test {project} failed for {framework}. See {logPath} for more details.");
}
}

View File

@@ -1,9 +1,11 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using System.Globalization;
namespace Microsoft.InsightsGenerator
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Concurrent;
using System.Composition;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection.Contracts
{
public class RequestSecurityTokenParams

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection.Contracts
{
public class RequestSecurityTokenResponse

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.Kusto.ServiceLayer.Connection.Contracts

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection
{
public interface IConnectionManager

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Threading.Tasks;
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
using Microsoft.Kusto.ServiceLayer.LanguageServices;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Contracts
{
public class DataSourceConnectionDetails

View File

@@ -1,6 +1,8 @@
// <copyright file="KustoQueryUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data;

View File

@@ -1,6 +1,7 @@
// <copyright file="DataSourceUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Composition;
using Kusto.Data;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource
{
/// <summary>
/// Represents the type of a data source.

View File

@@ -1,4 +1,9 @@
using System.Collections.Generic;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
namespace Microsoft.Kusto.ServiceLayer.DataSource
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
namespace Microsoft.Kusto.ServiceLayer.DataSource

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowDatabaseSchemaResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowDatabasesResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowFunctionsResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Data;
using System.Threading;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;

View File

@@ -1,6 +1,7 @@
// <copyright file="KustoDataSource.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Concurrent;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,4 +1,9 @@
using System.Collections.Generic;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Data;
namespace Microsoft.Kusto.ServiceLayer.DataSource.Kusto

View File

@@ -1,6 +1,8 @@
// <copyright file="KustoQueryUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Column metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Metadata type enumeration

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Object metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Database metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Folder metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
public class FunctionMetadata : DatabaseMetadata
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Kusto.ServiceLayer.Admin.Contracts;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Database metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class ColumnInfo
{

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class FunctionInfo
{

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class TableInfo
{

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Net.Http;
using System.Net.Http.Headers;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data;
using System.Linq;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Linq;
using Kusto.Language;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class ColumnsModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class TableGroupsModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class TablesModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class WorkspacesModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models;
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading.Tasks;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;
using Microsoft.Kusto.ServiceLayer.Connection;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Connection;
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
using Microsoft.Kusto.ServiceLayer.DataSource;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

View File

@@ -1,6 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ServiceLayer.SqlContext;
using Microsoft.Kusto.ServiceLayer.Utility;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.QueryExecution.Contracts.ExecuteRequests
{

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.QueryExecution.Contracts
{

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Workspace.Contracts;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol;
using System.Threading.Tasks;

View File

@@ -1,5 +1,4 @@
//
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

View File

@@ -1,6 +1,8 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.Kusto.ServiceLayer.QueryExecution

View File

@@ -1,4 +1,9 @@
using Microsoft.Kusto.ServiceLayer.DataSource;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.DataSource;
using Microsoft.Kusto.ServiceLayer.Scripting.Contracts;
using Microsoft.SqlServer.Management.Sdk.Sfc;

View File

@@ -1,4 +1,9 @@
using Microsoft.SqlServer.Dac;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Dac;
using System;
namespace Microsoft.Kusto.ServiceLayer.Utility

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Globalization;
using Microsoft.SqlTools.Hosting.Utility;

View File

@@ -1,6 +1,7 @@
// <copyright file="SystemExtensions.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Utility
{

View File

@@ -1,6 +1,7 @@
// <copyright file="ValidationUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Utility
{

View File

@@ -0,0 +1,15 @@
# See https://github.com/dotnet/roslyn-analyzers/blob/main/.editorconfig for an example on different settings and how they're used
# Disable checking for correct header for this project - most of the code is borrowed from other projects
# which have different style guidelines
[*.cs]
dotnet_diagnostic.IDE0073.severity = none
[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading.Tasks;
@@ -9,11 +10,11 @@ using Microsoft.SqlTools.ResourceProvider.Core.Extensibility;
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
/// <summary>
/// An account manager has the information of currently logged in user and can authenticate the user
/// An account manager has the information of currently logged in user and can authenticate the user
/// Implementing classes must add a <see cref="ExportableAttribute" />
/// to the class in order to be found by the extension manager,
/// and to define the type and category supported
/// </summary>
/// </summary>
public interface IAccountManager : IExportable
{
/// <summary>
@@ -46,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
/// </summary>
bool HasLoginDialog
{
get;
get;
}
/// <summary>

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -8,7 +9,7 @@ using System.Threading.Tasks;
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
/// <summary>
/// Provides functionality to authenticate to Azure and discover associated accounts and subscriptions
/// Provides functionality to authenticate to Azure and discover associated accounts and subscriptions
/// </summary>
public interface IAzureAuthenticationManager : IAccountManager
{
@@ -38,6 +39,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
/// <summary>
/// Stores the selected subscriptions given the ids
/// </summary>
Task<bool> SetSelectedSubscriptionsAsync(IEnumerable<string> subscriptionIds);
Task<bool> SetSelectedSubscriptionsAsync(IEnumerable<string> subscriptionIds);
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -30,6 +31,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
string SubscriptionId
{
get;
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
@@ -16,7 +17,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
/// <summary>
/// Display ID
/// </summary>
@@ -24,6 +25,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -18,6 +19,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
IAzureUserAccount UserAccount
{
get;
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
@@ -16,7 +17,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
/// <summary>
/// Returns true if user needs reauthentication
/// </summary>
@@ -24,6 +25,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
}
}

View File

@@ -30,12 +30,12 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AuthenticationService()
{
}
public override void InitializeService(IProtocolEndpoint serviceHost)
{
Logger.Write(TraceEventType.Verbose, "AuthenticationService initialized");
}
public async Task<IUserAccount> SetCurrentAccountAsync(Account account, Dictionary<string, AccountSecurityToken> securityTokenMappings)
{
var authManager = ServiceProvider.GetService<IAzureAuthenticationManager>();

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -13,7 +14,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
public static class CommonUtil
{
private const int KeyValueNameLength = 1024; // 1024 should be enough for registry key value name.
private const int KeyValueNameLength = 1024; // 1024 should be enough for registry key value name.
//********************************************************************************************
/// <summary>
@@ -44,7 +45,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
//********************************************************************************************
/// <summary>
/// Throw an exception if a string is null or empty.
/// Throw an exception if a string is null or empty.
/// </summary>
/// <param name="stringVar">string to check</param>
/// <param name="stringVarName">the variable or parameter name to display</param>
@@ -97,6 +98,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
return message;
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ResourceProvider.Core
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data.Common;
@@ -18,7 +19,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// Returns true if given exception if any of the inner exceptions is UserNeedsAuthenticationException
/// </summary>
internal static bool IsUserNeedsReauthenticateException(this Exception ex)
{
{
return ex.IsExceptionType(typeof(UserNeedsAuthenticationException));
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Runtime.Serialization;
@@ -8,7 +9,7 @@ using System.Runtime.Serialization;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// The exception is used if any operation fails as a request failed due to an expired token
/// The exception is used if any operation fails as a request failed due to an expired token
/// </summary>
public class ExpiredTokenException : ServiceExceptionBase
{
@@ -29,11 +30,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ExpiredTokenException(string message, Exception innerException)
: base(message, innerException)

View File

@@ -35,11 +35,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="httpStatusCode">The Http error code. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceExceptionBase(string message, HttpStatusCode httpStatusCode, Exception innerException = null)
: this(message, (int)httpStatusCode, innerException)
{
{
}
/// <summary>
@@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="httpStatusCode">The Http error code. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceExceptionBase(string message, int httpStatusCode, Exception innerException)
: base(message, innerException)
@@ -57,11 +57,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the AuthenticationFailedException class with a specified error message
/// Initializes a new instance of the AuthenticationFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
protected ServiceExceptionBase(string message, Exception innerException)
: base(message, innerException)

View File

@@ -32,11 +32,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceFailedException(string message, Exception innerException)
: base(message, innerException)
@@ -54,13 +54,13 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Creates a new instance of ServiceFailedException by adding the server definition info to the given message
/// Creates a new instance of ServiceFailedException by adding the server definition info to the given message
/// </summary>
internal static ServiceFailedException CreateException(string message, ServerDefinition serverDefinition, Exception innerException)
{
return new ServiceFailedException(
string.Format(CultureInfo.CurrentCulture, message,
serverDefinition != null ? serverDefinition.ServerType : string.Empty,
string.Format(CultureInfo.CurrentCulture, message,
serverDefinition != null ? serverDefinition.ServerType : string.Empty,
serverDefinition != null ? serverDefinition.Category : string.Empty), innerException);
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Runtime.Serialization;
@@ -8,7 +9,7 @@ using System.Runtime.Serialization;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// The exception is used if any operation fails becauase user needs to reauthenticate
/// The exception is used if any operation fails becauase user needs to reauthenticate
/// </summary>
public class UserNeedsAuthenticationException : ServiceExceptionBase
{
@@ -29,11 +30,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public UserNeedsAuthenticationException(string message, Exception innerException)
: base(message, innerException)

View File

@@ -68,13 +68,13 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
public class ProviderSettings
{
/// <summary>
/// Display name of the provider
/// Display name of the provider
/// </summary>
public string DisplayName;
/// <summary>
/// ID of the provider
/// </summary>
/// </summary>
public string Id;
/// <summary>
/// Settings for the provider itself

View File

@@ -28,7 +28,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
/// </summary>
public Account Account { get; set; }
/// <summary>
/// Per-tenant token mappings. Ideally would be set independently of this call, but for
/// Per-tenant token mappings. Ideally would be set independently of this call, but for
/// now this allows us to get the tokens necessary to find a server and open a firewall rule
/// </summary>
public Dictionary<string,AccountSecurityToken> SecurityTokenMappings { get; set; }
@@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
/// End of the IP address range
/// </summary>
public string EndIpAddress { get; set; }
}
public class CreateFirewallRuleResponse : TokenReliantResponse
@@ -61,7 +61,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
public class CanHandleFirewallRuleRequest
{
public static readonly
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse> Type =
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse> Type =
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse>.Create("resource/handleFirewallRule");
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -16,8 +17,8 @@ using Microsoft.SqlTools.Utility;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Default implementation for <see cref="IDatabaseDiscoveryProvider"/> for Azure Sql databases.
/// A discovery provider capable of finding Sql Azure databases for a specific Azure user account.
/// Default implementation for <see cref="IDatabaseDiscoveryProvider"/> for Azure Sql databases.
/// A discovery provider capable of finding Sql Azure databases for a specific Azure user account.
/// </summary>
[Exportable(
@@ -35,7 +36,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AzureDatabaseDiscoveryProvider()
{
// Duplicate the exportable attribute as at present we do not support filtering using extensiondescriptor.
// The attribute is preserved in order to simplify ability to backport into existing tools
// The attribute is preserved in order to simplify ability to backport into existing tools
Metadata = new ExportableMetadata(
ServerTypes.SqlServer,
Categories.Azure,
@@ -90,9 +91,9 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Returns the databases for given connection info.
/// Returns the databases for given connection info.
/// The connection info should be used to make the connection for getting databases not the account manager
/// </summary>
/// </summary>
//public async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabaseInstancesAsync(UIConnectionInfo uiConnectionInfo, CancellationToken cancellationToken)
//{
// ServiceResponse<DatabaseInstanceInfo> result = null;
@@ -109,7 +110,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// Returns the databases for given server name. Using the account manager to get the databases
/// </summary>
/// </summary>
public async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabaseInstancesAsync(string serverName, CancellationToken cancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;
@@ -120,7 +121,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
//if connection is passed, we need to search all subscriptions not selected ones
IEnumerable<IAzureUserAccountSubscriptionContext> subscriptions = await GetSubscriptionsAsync(string.IsNullOrEmpty(serverName));
if (!cancellationToken.IsCancellationRequested)
{
{
result = await AzureUtil.ExecuteGetAzureResourceAsParallel((object)null, subscriptions, serverName, cancellationToken,
GetDatabaseForSubscriptionAsync);
}
@@ -159,7 +160,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
get
{
return (_azureAccountManager = _azureAccountManager ?? GetService<IAzureAuthenticationManager>());
}
}
}
/// <summary>
@@ -206,11 +207,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// There was a wired nullReferencedException was running the tasks parallel. It only got fixed when I put the getting from cache insed an async method
/// </summary>
/// </summary>
private Task<ServiceResponse<DatabaseInstanceInfo>> GetFromCacheAsync(string key)
{
return Task.Factory.StartNew(() => _cache.Get(key));
}
}
/// <summary>
/// Returns a list of Azure sql databases for given subscription
@@ -235,7 +236,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
else if (shouldFilter)
{
//we should filter the result because the cached data includes databases for all servers
result = new ServiceResponse<DatabaseInstanceInfo>(result.Data.Where(x => x.ServerInstanceInfo.FullyQualifiedDomainName == serverName),
result = new ServiceResponse<DatabaseInstanceInfo>(result.Data.Where(x => x.ServerInstanceInfo.FullyQualifiedDomainName == serverName),
result.Errors);
}
@@ -243,7 +244,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
if (!shouldFilter && !cancellationToken.IsCancellationRequested)
{
result = _cache.UpdateCache(key, result);
}
}
}
catch (Exception ex)
{
@@ -261,7 +262,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
CancellationToken cancellationToken, CancellationToken internalCancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;
try
{
if (!cancellationToken.IsCancellationRequested && !internalCancellationToken.IsCancellationRequested)
@@ -295,7 +296,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
return result ?? new ServiceResponse<DatabaseInstanceInfo>();
}
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForSubscriptionServersAsync(IAzureResourceManagementSession session,
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForSubscriptionServersAsync(IAzureResourceManagementSession session,
IList<IAzureSqlServerResource> filteredServersList, CancellationToken cancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -43,7 +44,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
result = await AzureUtil.ExecuteGetAzureResourceAsParallel(_session, serverResources, null, cancellationToken, GetDatabasesForServerFromService);
}
return result;
}
}
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForServerFromService(
IAzureResourceManagementSession session,
@@ -108,7 +109,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// Converts the resource to DatabaseInstanceInfo
/// </summary>
/// </summary>
private DatabaseInstanceInfo ConvertToModel(ServerInstanceInfo serverInstanceInfo, IAzureResource azureResource)
{
DatabaseInstanceInfo databaseInstance = new DatabaseInstanceInfo(serverInstanceInfo)

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -12,11 +13,11 @@ using Microsoft.SqlTools.ResourceProvider.Core.Extensibility;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Default implementation for <see cref="IServerDiscoveryProvider"/> for Azure Sql servers.
/// A discovery provider capable of finding Sql Azure servers for a specific Azure user account.
/// Default implementation for <see cref="IServerDiscoveryProvider"/> for Azure Sql servers.
/// A discovery provider capable of finding Sql Azure servers for a specific Azure user account.
/// </summary>
[Exportable(
ServerTypes.SqlServer,
ServerTypes.SqlServer,
Categories.Azure,
typeof(IServerDiscoveryProvider),
"Microsoft.SqlServer.ConnectionServices.Azure.AzureServerDiscoveryProvider")]
@@ -28,7 +29,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AzureSqlServerDiscoveryProvider()
{
// Duplicate the exportable attribute as at present we do not support filtering using extensiondescriptor.
// The attribute is preserved in order to simplify ability to backport into existing tools
// The attribute is preserved in order to simplify ability to backport into existing tools
Metadata = new ExportableMetadata(
ServerTypes.SqlServer,
Categories.Azure,
@@ -120,6 +121,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
{
_azureAccountManager = value as IAzureAuthenticationManager;
}
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -12,7 +13,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public class DatabaseInstanceInfo
{
/// <summary>
/// Default constructor to initialize the instance
/// Default constructor to initialize the instance
/// </summary>
/// <param name="serverInstanceInfo"></param>
public DatabaseInstanceInfo(ServerInstanceInfo serverInstanceInfo)
@@ -34,7 +35,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
public ServerInstanceInfo ServerInstanceInfo
{
get;
get;
private set;
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ResourceProvider.Core
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ResourceProvider.Core.Authentication;
@@ -11,7 +12,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// A session used by <see cref="IAzureResourceManager" />. Includes all the clients that the resource management needs to get ther resources
/// </summary>
public interface IAzureResourceManagementSession : IDisposable
{
{
/// <summary>
/// Closes the session
/// </summary>

Some files were not shown because too many files have changed in this diff Show More