diff --git a/src/Microsoft.SqlTools.Hosting/Hosting/Protocol/ProtocolEndpoint.cs b/src/Microsoft.SqlTools.Hosting/Hosting/Protocol/ProtocolEndpoint.cs index 6ea05512..bcfdc3d1 100644 --- a/src/Microsoft.SqlTools.Hosting/Hosting/Protocol/ProtocolEndpoint.cs +++ b/src/Microsoft.SqlTools.Hosting/Hosting/Protocol/ProtocolEndpoint.cs @@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.Hosting.Protocol /// handlers for requests, responses, and events that are /// transmitted through the channel. /// - internal MessageDispatcher MessageDispatcher { get; set; } + public MessageDispatcher MessageDispatcher { get; set; } /// /// Initializes an instance of the protocol server using the @@ -158,14 +158,14 @@ namespace Microsoft.SqlTools.Hosting.Protocol /// /// public Task SendRequest( - RequestType requestType, + RequestType requestType, TParams requestParams) { return this.SendRequest(requestType, requestParams, true); } public async Task SendRequest( - RequestType requestType, + RequestType requestType, TParams requestParams, bool waitForResponse) { @@ -182,13 +182,13 @@ namespace Microsoft.SqlTools.Hosting.Protocol { responseTask = new TaskCompletionSource(); this.pendingRequests.Add( - this.currentMessageId.ToString(), + this.currentMessageId.ToString(), responseTask); } await this.protocolChannel.MessageWriter.WriteRequest( - requestType, - requestParams, + requestType, + requestParams, this.currentMessageId); if (responseTask != null) diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.cs b/src/Microsoft.SqlTools.Hosting/Localization/sr.cs index ef9923d8..7658fb64 100755 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.cs +++ b/src/Microsoft.SqlTools.Hosting/Localization/sr.cs @@ -93,22 +93,6 @@ namespace Microsoft.SqlTools.Hosting } } - public static string ServiceProviderNotSet - { - get - { - return Keys.GetString(Keys.ServiceProviderNotSet); - } - } - - public static string ServiceNotFound - { - get - { - return Keys.GetString(Keys.ServiceNotFound); - } - } - public static string ServiceNotOfExpectedType { get @@ -181,12 +165,6 @@ namespace Microsoft.SqlTools.Hosting public const string IncompatibleServiceForExtensionLoader = "IncompatibleServiceForExtensionLoader"; - public const string ServiceProviderNotSet = "ServiceProviderNotSet"; - - - public const string ServiceNotFound = "ServiceNotFound"; - - public const string ServiceNotOfExpectedType = "ServiceNotOfExpectedType"; diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.resx b/src/Microsoft.SqlTools.Hosting/Localization/sr.resx index 5b0067c2..cb44a579 100755 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.resx +++ b/src/Microsoft.SqlTools.Hosting/Localization/sr.resx @@ -149,14 +149,6 @@ Service of type {0} cannot be created by ExtensionLoader<{1}> - - SetServiceProvider() was not called to establish the required service provider - - - - Service {0} was not found in the service provider - - Service of Type {0} is not compatible with registered Type {1} diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.strings b/src/Microsoft.SqlTools.Hosting/Localization/sr.strings index 37d5e4ec..4257b471 100644 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.strings +++ b/src/Microsoft.SqlTools.Hosting/Localization/sr.strings @@ -1,11 +1,11 @@ -# String resource file +# String resource file # # When processed by the String Resource Tool, this file generates # both a .CS and a .RESX file with the same name as the file. -# The .CS file contains a class which can be used to access these -# string resources, including the ability to format in +# The .CS file contains a class which can be used to access these +# string resources, including the ability to format in # parameters, which are identified with the .NET {x} format -# (see String.Format help). +# (see String.Format help). # # Comments below assume the file name is SR.strings. # @@ -15,7 +15,7 @@ # # SMO build specific comment # after generating the .resx file, run srgen on it and get the .resx file -# please remember to also check that .resx in, along with the +# please remember to also check that .resx in, along with the # .strings and .cs files [strings] @@ -42,10 +42,6 @@ MultipleServicesFound = Multiple services found for type {0}, expected only 1 IncompatibleServiceForExtensionLoader = Service of type {0} cannot be created by ExtensionLoader<{1}> -ServiceProviderNotSet = SetServiceProvider() was not called to establish the required service provider - -ServiceNotFound = Service {0} was not found in the service provider - ServiceNotOfExpectedType = Service of Type {0} is not compatible with registered Type {1} ############################################################################ diff --git a/src/Microsoft.SqlTools.Hosting/Localization/sr.xlf b/src/Microsoft.SqlTools.Hosting/Localization/sr.xlf index eb98421f..c96de209 100644 --- a/src/Microsoft.SqlTools.Hosting/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.Hosting/Localization/sr.xlf @@ -62,16 +62,6 @@ Service of type {0} cannot be created by ExtensionLoader<{1}> - - SetServiceProvider() was not called to establish the required service provider - SetServiceProvider() was not called to establish the required service provider - - - - Service {0} was not found in the service provider - Service {0} was not found in the service provider - - Service of Type {0} is not compatible with registered Type {1} Service of Type {0} is not compatible with registered Type {1} diff --git a/src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj b/src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj index 18b964a5..d45ca34f 100644 --- a/src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj +++ b/src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj @@ -26,10 +26,6 @@ - - - - diff --git a/src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs b/src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs index 5c8e290e..e38910d6 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs @@ -10,10 +10,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility { /// - /// This listener class will listen for events from the SqlClientEventSource class + /// This listener class will listen for events from the SqlClientEventSource class /// and forward them to the logger. /// - internal class SqlClientListener : EventListener + public class SqlClientListener : EventListener { protected override void OnEventSourceCreated(EventSource eventSource) { diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index 4f2e1a24..73913c15 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -10613,6 +10613,14 @@ namespace Microsoft.SqlTools.ServiceLayer } } + public static string ServiceProviderNotSet + { + get + { + return Keys.GetString(Keys.ServiceProviderNotSet); + } + } + public static string ConnectionServiceListDbErrorNotConnected(string uri) { return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri); @@ -11043,6 +11051,11 @@ namespace Microsoft.SqlTools.ServiceLayer return Keys.GetString(Keys.ObjectNotRenamable, urn); } + public static string ServiceNotFound(string serviceName) + { + return Keys.GetString(Keys.ServiceNotFound, serviceName); + } + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Keys { @@ -15278,6 +15291,12 @@ namespace Microsoft.SqlTools.ServiceLayer public const string Permission_ImpersonateAnyLogin = "Permission_ImpersonateAnyLogin"; + public const string ServiceProviderNotSet = "ServiceProviderNotSet"; + + + public const string ServiceNotFound = "ServiceNotFound"; + + private Keys() { } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx index 920de080..26d974d8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx @@ -380,7 +380,7 @@ - Could not retrieve an execution plan from the result set + Could not retrieve an execution plan from the result set @@ -402,7 +402,7 @@ Parameters: 0 - lineNumber (int) - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} . Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) @@ -412,7 +412,7 @@ Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} . Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) @@ -1745,7 +1745,7 @@ - Unknown size unit {0} + Unknown size unit {0} . Parameters: 0 - unit (string) @@ -1844,7 +1844,7 @@ - Path {0} is not a valid directory + Path {0} is not a valid directory @@ -3070,7 +3070,7 @@ Table name for the referenced object. - Table property description + Table property description Alias @@ -4262,7 +4262,7 @@ Operator name - Applies a trained machine learning model to input data + Applies a trained machine learning model to input data Operator description @@ -4906,7 +4906,7 @@ The Query Processor estimates that implementing the following index could improv - Bucket count of the hash index, note the value will always automatically round up to the next power of 2. + Bucket count of the hash index, note the value will always automatically round up to the next power of 2. @@ -5843,4 +5843,13 @@ The Query Processor estimates that implementing the following index could improv Impersonate Any Login + + SetServiceProvider() was not called to establish the required service provider + + + + Service {0} was not found in the service provider + . + Parameters: 0 - serviceName (string) + diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings index 3ae8955c..aa2925ab 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings @@ -1,11 +1,11 @@ -# String resource file +# String resource file # # When processed by the String Resource Tool, this file generates # both a .CS and a .RESX file with the same name as the file. -# The .CS file contains a class which can be used to access these -# string resources, including the ability to format in +# The .CS file contains a class which can be used to access these +# string resources, including the ability to format in # parameters, which are identified with the .NET {x} format -# (see String.Format help). +# (see String.Format help). # # Comments below assume the file name is SR.strings. # @@ -15,7 +15,7 @@ # # SMO build specific comment # after generating the .resx file, run srgen on it and get the .resx file -# please remember to also check that .resx in, along with the +# please remember to also check that .resx in, along with the # .strings and .cs files [strings] @@ -166,7 +166,7 @@ QueryServiceResultSetRowCountOutOfRange = Row count must be a positive integer QueryServiceResultSetNoColumnSchema = Could not retrieve column schema for result set -QueryServiceExecutionPlanNotFound = Could not retrieve an execution plan from the result set +QueryServiceExecutionPlanNotFound = Could not retrieve an execution plan from the result set SqlCmdExitOnError = An error was encountered during execution of batch. Exiting. @@ -178,11 +178,11 @@ ParameterizationDetails (string variableName, string sqlDbType, int size, int pr ErrorMessageHeader(int lineNumber) = Line {0} -ErrorMessage (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} +ErrorMessage (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} DateTimeErrorMessage (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as it used an unsupported date/time format. Use one of the supported date/time formats. Literal value: {2} -BinaryLiteralPrefixMissingError (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} +BinaryLiteralPrefixMissingError (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} ParsingErrorHeader (int lineNumber, int columnNumber) = Line {0}, column {1} @@ -194,7 +194,7 @@ ScriptTooLarge (int maxChars, int currentChars) = The current script is too larg SerializationServiceUnsupportedFormat (string formatName) = Unsupported Save Format: {0} SerializationServiceRequestInProgress (string filePath) = A request for file {0} is already in progress SerializationServiceRequestNotFound (string filePath) = Cannot serialize more data as no request for file {0} could be found - + ############################################################################ # Language Service @@ -826,7 +826,7 @@ CategoryLogShipping = Log Shipping CategoryDBEngineTuningAdvisor = Database Engine Tuning Advisor CategoryDataCollector = Data Collector -UnknownSizeUnit(unit) = Unknown size unit {0} +UnknownSizeUnit(unit) = Unknown size unit {0} UnexpectedRunType = Unexpected run type. CredentialNoLongerExists = The object does no longer exist on server. UnknownServerType(string serverTypeName) = Unknown server type '{0}'. @@ -857,7 +857,7 @@ JobServerIsNotAvailable = Job server is not available # Admin Service NeverBackedUp = Never -Error_InvalidDirectoryName = Path {0} is not a valid directory +Error_InvalidDirectoryName = Path {0} is not a valid directory Error_ExistingDirectoryName = For directory {0} a file with name {1} already exist ############################################################################ @@ -1457,7 +1457,7 @@ ObjectSchema = Schema ObjectSchemaDescription = Schema name for the referenced object. ; Table property ObjectTable = Table -; Table property description +; Table property description ObjectTableDescription = Table name for the referenced object. ; Alias property ObjectAlias = Alias @@ -2045,7 +2045,7 @@ SwitchDescription = Switch. ; Operator name TFP = Predict ; Operator description -TFPDescription = Applies a trained machine learning model to input data +TFPDescription = Applies a trained machine learning model to input data ; Operator name TableValueFunction = Table Valued Function ; Operator description @@ -2323,7 +2323,7 @@ IndexFilterPredicatePropertyDescription = Filter predicate of the index IndexFilterPredicatePropertyTitle = Filter Predicate IndexIsHashPropertyDescription = Whether the index is a hash index IndexIsHashPropertyTitle = Is Hash -IndexBucketCountPropertyDescription = Bucket count of the hash index, note the value will always automatically round up to the next power of 2. +IndexBucketCountPropertyDescription = Bucket count of the hash index, note the value will always automatically round up to the next power of 2. IndexBucketCountPropertyTitle = Bucket Count TableDesignerColumnsDisplayValueTitle = Columns ColumnStoreIndexNamePropertyTitle = Name @@ -2567,3 +2567,6 @@ Permission_CreateAvailabilityGroup = Create availability group Permission_SelectAllUserSecurables = Select All User Securables Permission_ConnectAnyDatabase = Connect Any Database Permission_ImpersonateAnyLogin = Impersonate Any Login + +ServiceProviderNotSet = SetServiceProvider() was not called to establish the required service provider +ServiceNotFound(string serviceName) = Service {0} was not found in the service provider diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf index b6338bfb..8aaba375 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf @@ -211,8 +211,8 @@ - Could not retrieve an execution plan from the result set - Could not retrieve an execution plan from the result set + Could not retrieve an execution plan from the result set + Could not retrieve an execution plan from the result set @@ -1845,8 +1845,8 @@ - Unknown size unit {0} - Unknown size unit {0} + Unknown size unit {0} + Unknown size unit {0} . Parameters: 0 - unit (string) @@ -1932,8 +1932,8 @@ - Path {0} is not a valid directory - Path {0} is not a valid directory + Path {0} is not a valid directory + Path {0} is not a valid directory @@ -2096,8 +2096,8 @@ Parameters: 0 - lineNumber (int) - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} . Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) @@ -2108,8 +2108,8 @@ Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} - Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} + Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} . Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) @@ -5070,8 +5070,8 @@ Operator name - Applies a trained machine learning model to input data - Applies a trained machine learning model to input data + Applies a trained machine learning model to input data + Applies a trained machine learning model to input data Operator description @@ -6394,8 +6394,8 @@ The Query Processor estimates that implementing the following index could improv - Bucket count of the hash index, note the value will always automatically round up to the next power of 2. - Bucket count of the hash index, note the value will always automatically round up to the next power of 2. + Bucket count of the hash index, note the value will always automatically round up to the next power of 2. + Bucket count of the hash index, note the value will always automatically round up to the next power of 2. @@ -7137,6 +7137,16 @@ The Query Processor estimates that implementing the following index could improv Impersonate Any Login + + SetServiceProvider() was not called to establish the required service provider + SetServiceProvider() was not called to establish the required service provider + + + + Service {0} was not found in the service provider + Service {0} was not found in the service provider + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index 7e7f1b22..11ef6da6 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -714,11 +714,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer { if (serviceProvider == null) { - throw new InvalidOperationException(SqlTools.Hosting.SR.ServiceProviderNotSet); + throw new InvalidOperationException(SR.ServiceProviderNotSet); } if (connectionService == null) { - throw new InvalidOperationException(SqlTools.Hosting.SR.ServiceProviderNotSet); + throw new InvalidOperationException(SR.ServiceProviderNotSet); } } @@ -771,7 +771,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer /// public bool IsSuccessful { get; set; } /// - /// The Exception that occurred during execution, if any. + /// The Exception that occurred during execution, if any. /// public Exception? Exception { get; set; } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs index e5507d32..c5430046 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryContext.cs @@ -6,7 +6,6 @@ #nullable disable using System; -using System.Globalization; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlTools.Extensibility; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; @@ -41,7 +40,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } /// - /// The server type + /// The server type /// public SqlServerType SqlServerType { get; set; } @@ -116,12 +115,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { if (ServiceProvider == null) { - throw new InvalidOperationException(SqlTools.Hosting.SR.ServiceProviderNotSet); + throw new InvalidOperationException(SR.ServiceProviderNotSet); } return ServiceProvider.GetService() - ?? throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, - SqlTools.Hosting.SR.ServiceNotFound, nameof(ObjectExplorerService))); + ?? throw new InvalidOperationException(SR.ServiceNotFound(nameof(ObjectExplorerService))); } /// @@ -196,7 +194,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel } /// - /// Ensures the server objects connection context is open. This is used by all child objects, and + /// Ensures the server objects connection context is open. This is used by all child objects, and /// the only way to easily access is via the server object. This should be called during access of /// any of the object properties ///