Remove Hosting InternalsVisibleTo (#2009)

This commit is contained in:
Charles Gagnon
2023-04-17 12:34:04 -07:00
committed by GitHub
parent 9d53e1dd3e
commit efc8d8f0be
13 changed files with 97 additions and 106 deletions

View File

@@ -45,7 +45,7 @@ namespace Microsoft.SqlTools.Hosting.Protocol
/// handlers for requests, responses, and events that are
/// transmitted through the channel.
/// </summary>
internal MessageDispatcher MessageDispatcher { get; set; }
public MessageDispatcher MessageDispatcher { get; set; }
/// <summary>
/// Initializes an instance of the protocol server using the

View File

@@ -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";

View File

@@ -149,14 +149,6 @@
<value>Service of type {0} cannot be created by ExtensionLoader&lt;{1}&gt;</value>
<comment></comment>
</data>
<data name="ServiceProviderNotSet" xml:space="preserve">
<value>SetServiceProvider() was not called to establish the required service provider</value>
<comment></comment>
</data>
<data name="ServiceNotFound" xml:space="preserve">
<value>Service {0} was not found in the service provider</value>
<comment></comment>
</data>
<data name="ServiceNotOfExpectedType" xml:space="preserve">
<value>Service of Type {0} is not compatible with registered Type {1}</value>
<comment></comment>

View File

@@ -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}
############################################################################

View File

@@ -62,16 +62,6 @@
<target state="new">Service of type {0} cannot be created by ExtensionLoader&lt;{1}&gt;</target>
<note></note>
</trans-unit>
<trans-unit id="ServiceProviderNotSet">
<source>SetServiceProvider() was not called to establish the required service provider</source>
<target state="new">SetServiceProvider() was not called to establish the required service provider</target>
<note></note>
</trans-unit>
<trans-unit id="ServiceNotFound">
<source>Service {0} was not found in the service provider</source>
<target state="new">Service {0} was not found in the service provider</target>
<note></note>
</trans-unit>
<trans-unit id="ServiceNotOfExpectedType">
<source>Service of Type {0} is not compatible with registered Type {1}</source>
<target state="new">Service of Type {0} is not compatible with registered Type {1}</target>

View File

@@ -26,10 +26,6 @@
<InternalsVisibleTo Include="Microsoft.SqlTools.ServiceLayer.UnitTests" />
<InternalsVisibleTo Include="Microsoft.SqlTools.ServiceLayer.IntegrationTests" />
<InternalsVisibleTo Include="Microsoft.SqlTools.ServiceLayer.Test.Common" />
<!-- Workaround for SRGen issues -->
<InternalsVisibleTo Include="MicrosoftSqlToolsServiceLayer" />
<InternalsVisibleTo Include="MicrosoftKustoServiceLayer" />
<InternalsVisibleTo Include="MicrosoftSqlToolsCredentials" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\*.resx" />

View File

@@ -13,7 +13,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
/// This listener class will listen for events from the SqlClientEventSource class
/// and forward them to the logger.
/// </summary>
internal class SqlClientListener : EventListener
public class SqlClientListener : EventListener
{
protected override void OnEventSourceCreated(EventSource eventSource)
{

View File

@@ -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()
{ }

View File

@@ -380,7 +380,7 @@
<comment></comment>
</data>
<data name="QueryServiceExecutionPlanNotFound" xml:space="preserve">
<value>Could not retrieve an execution plan from the result set </value>
<value>Could not retrieve an execution plan from the result set</value>
<comment></comment>
</data>
<data name="SqlCmdExitOnError" xml:space="preserve">
@@ -402,7 +402,7 @@
Parameters: 0 - lineNumber (int) </comment>
</data>
<data name="ErrorMessage" xml:space="preserve">
<value>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} </value>
<value>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}</value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
@@ -412,7 +412,7 @@
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
<data name="BinaryLiteralPrefixMissingError" xml:space="preserve">
<value>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} </value>
<value>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}</value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
@@ -1745,7 +1745,7 @@
<comment></comment>
</data>
<data name="UnknownSizeUnit" xml:space="preserve">
<value>Unknown size unit {0} </value>
<value>Unknown size unit {0}</value>
<comment>.
Parameters: 0 - unit (string) </comment>
</data>
@@ -1844,7 +1844,7 @@
<comment></comment>
</data>
<data name="Error_InvalidDirectoryName" xml:space="preserve">
<value>Path {0} is not a valid directory </value>
<value>Path {0} is not a valid directory</value>
<comment></comment>
</data>
<data name="Error_ExistingDirectoryName" xml:space="preserve">
@@ -3070,7 +3070,7 @@
</data>
<data name="ObjectTableDescription" xml:space="preserve">
<value>Table name for the referenced object.</value>
<comment> Table property description </comment>
<comment> Table property description</comment>
</data>
<data name="ObjectAlias" xml:space="preserve">
<value>Alias</value>
@@ -4262,7 +4262,7 @@
<comment> Operator name</comment>
</data>
<data name="TFPDescription" xml:space="preserve">
<value>Applies a trained machine learning model to input data </value>
<value>Applies a trained machine learning model to input data</value>
<comment> Operator description</comment>
</data>
<data name="TableValueFunction" xml:space="preserve">
@@ -4906,7 +4906,7 @@ The Query Processor estimates that implementing the following index could improv
<comment></comment>
</data>
<data name="IndexBucketCountPropertyDescription" xml:space="preserve">
<value>Bucket count of the hash index, note the value will always automatically round up to the next power of 2. </value>
<value>Bucket count of the hash index, note the value will always automatically round up to the next power of 2.</value>
<comment></comment>
</data>
<data name="IndexBucketCountPropertyTitle" xml:space="preserve">
@@ -5843,4 +5843,13 @@ The Query Processor estimates that implementing the following index could improv
<value>Impersonate Any Login</value>
<comment></comment>
</data>
<data name="ServiceProviderNotSet" xml:space="preserve">
<value>SetServiceProvider() was not called to establish the required service provider</value>
<comment></comment>
</data>
<data name="ServiceNotFound" xml:space="preserve">
<value>Service {0} was not found in the service provider</value>
<comment>.
Parameters: 0 - serviceName (string) </comment>
</data>
</root>

View File

@@ -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

View File

@@ -211,8 +211,8 @@
<note></note>
</trans-unit>
<trans-unit id="QueryServiceExecutionPlanNotFound">
<source>Could not retrieve an execution plan from the result set </source>
<target state="new">Could not retrieve an execution plan from the result set </target>
<source>Could not retrieve an execution plan from the result set</source>
<target state="new">Could not retrieve an execution plan from the result set</target>
<note></note>
</trans-unit>
<trans-unit id="PeekDefinitionAzureError">
@@ -1845,8 +1845,8 @@
<note></note>
</trans-unit>
<trans-unit id="UnknownSizeUnit">
<source>Unknown size unit {0} </source>
<target state="new">Unknown size unit {0} </target>
<source>Unknown size unit {0}</source>
<target state="new">Unknown size unit {0}</target>
<note>.
Parameters: 0 - unit (string) </note>
</trans-unit>
@@ -1932,8 +1932,8 @@
<note></note>
</trans-unit>
<trans-unit id="Error_InvalidDirectoryName">
<source>Path {0} is not a valid directory </source>
<target state="new">Path {0} is not a valid directory </target>
<source>Path {0} is not a valid directory</source>
<target state="new">Path {0} is not a valid directory</target>
<note></note>
</trans-unit>
<trans-unit id="Error_ExistingDirectoryName">
@@ -2096,8 +2096,8 @@
Parameters: 0 - lineNumber (int) </note>
</trans-unit>
<trans-unit id="ErrorMessage">
<source>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} </source>
<target state="new">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} </target>
<source>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}</source>
<target state="new">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}</target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
@@ -2108,8 +2108,8 @@
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
<trans-unit id="BinaryLiteralPrefixMissingError">
<source>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} </source>
<target state="new">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} </target>
<source>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}</source>
<target state="new">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}</target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
@@ -5070,8 +5070,8 @@
<note> Operator name</note>
</trans-unit>
<trans-unit id="TFPDescription">
<source>Applies a trained machine learning model to input data </source>
<target state="new">Applies a trained machine learning model to input data </target>
<source>Applies a trained machine learning model to input data</source>
<target state="new">Applies a trained machine learning model to input data</target>
<note> Operator description</note>
</trans-unit>
<trans-unit id="TableValueFunction">
@@ -6394,8 +6394,8 @@ The Query Processor estimates that implementing the following index could improv
<note></note>
</trans-unit>
<trans-unit id="IndexBucketCountPropertyDescription">
<source>Bucket count of the hash index, note the value will always automatically round up to the next power of 2. </source>
<target state="new">Bucket count of the hash index, note the value will always automatically round up to the next power of 2. </target>
<source>Bucket count of the hash index, note the value will always automatically round up to the next power of 2.</source>
<target state="new">Bucket count of the hash index, note the value will always automatically round up to the next power of 2.</target>
<note></note>
</trans-unit>
<trans-unit id="IndexBucketCountPropertyTitle">
@@ -7137,6 +7137,16 @@ The Query Processor estimates that implementing the following index could improv
<target state="new">Impersonate Any Login</target>
<note></note>
</trans-unit>
<trans-unit id="ServiceProviderNotSet">
<source>SetServiceProvider() was not called to establish the required service provider</source>
<target state="new">SetServiceProvider() was not called to establish the required service provider</target>
<note></note>
</trans-unit>
<trans-unit id="ServiceNotFound">
<source>Service {0} was not found in the service provider</source>
<target state="new">Service {0} was not found in the service provider</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -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);
}
}

View File

@@ -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;
@@ -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<ObjectExplorerService>()
?? throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
SqlTools.Hosting.SR.ServiceNotFound, nameof(ObjectExplorerService)));
?? throw new InvalidOperationException(SR.ServiceNotFound(nameof(ObjectExplorerService)));
}
/// <summary>