From 7cb962c2ccdeddce8368ae369bdf226be439b450 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Thu, 8 Jul 2021 13:45:05 -0700 Subject: [PATCH] address comments --- src/Directory.Build.props | 4 - .../Interop.GssApiException.cs | 1 - .../Interop.GssBuffer.cs | 1 - .../Interop/Windows/sspicli/SSPIAuthType.cs | 2 +- .../Windows/sspicli/SSPISecureChannelType.cs | 1 - .../Interop/Windows/sspicli/SSPIWrapper.cs | 2 +- .../src/Microsoft.Data.SqlClient.csproj | 2 +- .../SqlConnectionStringBuilder.NetCoreApp.cs | 1 + .../netcore/src/Resources/Strings.Designer.cs | 407 +++++++++++++++++- .../netcore/src/Resources/Strings.resx | 126 ++++++ .../netcore/src/Resources/StringsHelper.cs | 2 +- .../scripts/GenerateResourceStringsSource.ps1 | 52 +++ .../GenerateResourceStringsSource.targets | 11 + .../netfx/src/Microsoft.Data.SqlClient.csproj | 2 +- .../scripts/GenerateResourceStringsSource.ps1 | 2 +- .../GenerateResourceStringsSource.targets | 2 +- tools/targets/GenerateAssemblyInfo.targets | 37 -- tools/targets/GenerateAssemblyRef.targets | 31 -- 18 files changed, 591 insertions(+), 95 deletions(-) create mode 100644 src/Microsoft.Data.SqlClient/netcore/tools/scripts/GenerateResourceStringsSource.ps1 create mode 100644 src/Microsoft.Data.SqlClient/netcore/tools/targets/GenerateResourceStringsSource.targets rename {tools => src/Microsoft.Data.SqlClient/netfx/tools}/scripts/GenerateResourceStringsSource.ps1 (99%) rename {tools => src/Microsoft.Data.SqlClient/netfx/tools}/targets/GenerateResourceStringsSource.targets (64%) delete mode 100644 tools/targets/GenerateAssemblyInfo.targets delete mode 100644 tools/targets/GenerateAssemblyRef.targets diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ebc5b690c2..983cafb5dd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -28,10 +28,6 @@ $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) - - $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(GeneratedSourceFileName)')) - - diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs index aafc36e6d6..2defe1a735 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using Microsoft.Data; using System.Runtime.InteropServices; internal static partial class Interop diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs index 536d5e0397..80a32e6c5a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using Microsoft.Data; using System.Runtime.InteropServices; internal static partial class Interop diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs index cdb3819605..b7dbedc0a8 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Net.Security; using System.Runtime.InteropServices; -using Microsoft.Data; namespace System.Net { diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs index 4152a89a7d..be9f3da733 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs @@ -4,7 +4,6 @@ using System.Net.Security; using System.Runtime.InteropServices; -using Microsoft.Data; namespace System.Net { diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs index f8231f9069..60651985fd 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs @@ -2,11 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.ComponentModel; using System.Globalization; using System.Net.Security; using System.Runtime.InteropServices; -using Microsoft.Data; namespace System.Net { diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 8cf3c03d74..380205196f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -878,5 +878,5 @@ - + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.NetCoreApp.cs index 2c0fbdc93d..2379690288 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.NetCoreApp.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.ComponentModel; using System.Data.Common; using System.Diagnostics; diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs index e043593408..057f73c6e9 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs @@ -942,6 +942,366 @@ internal static string Data_InvalidOffsetLength { } } + /// + /// Looks up a localized string similar to Advanced. + /// + internal static string DataCategory_Advanced { + get { + return ResourceManager.GetString("DataCategory_Advanced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connection Resiliency. + /// + internal static string DataCategory_ConnectionResilency { + get { + return ResourceManager.GetString("DataCategory_ConnectionResilency", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Context. + /// + internal static string DataCategory_Context { + get { + return ResourceManager.GetString("DataCategory_Context", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initialization. + /// + internal static string DataCategory_Initialization { + get { + return ResourceManager.GetString("DataCategory_Initialization", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Pooling. + /// + internal static string DataCategory_Pooling { + get { + return ResourceManager.GetString("DataCategory_Pooling", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replication. + /// + internal static string DataCategory_Replication { + get { + return ResourceManager.GetString("DataCategory_Replication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Security. + /// + internal static string DataCategory_Security { + get { + return ResourceManager.GetString("DataCategory_Security", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Source. + /// + internal static string DataCategory_Source { + get { + return ResourceManager.GetString("DataCategory_Source", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Time to wait for command to execute.. + /// + internal static string DbCommand_CommandTimeout { + get { + return ResourceManager.GetString("DbCommand_CommandTimeout", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Declares the application workload type when connecting to a server.. + /// + internal static string DbConnectionString_ApplicationIntent { + get { + return ResourceManager.GetString("DbConnectionString_ApplicationIntent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The name of the application.. + /// + internal static string DbConnectionString_ApplicationName { + get { + return ResourceManager.GetString("DbConnectionString_ApplicationName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The name of the primary file, including the full path name, of an attachable database.. + /// + internal static string DbConnectionString_AttachDBFilename { + get { + return ResourceManager.GetString("DbConnectionString_AttachDBFilename", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specifies the method of authenticating with SQL Server.. + /// + internal static string DbConnectionString_Authentication { + get { + return ResourceManager.GetString("DbConnectionString_Authentication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Number of attempts to restore connection.. + /// + internal static string DbConnectionString_ConnectRetryCount { + get { + return ResourceManager.GetString("DbConnectionString_ConnectRetryCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delay between attempts to restore connection.. + /// + internal static string DbConnectionString_ConnectRetryInterval { + get { + return ResourceManager.GetString("DbConnectionString_ConnectRetryInterval", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.. + /// + internal static string DbConnectionString_ConnectTimeout { + get { + return ResourceManager.GetString("DbConnectionString_ConnectTimeout", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SQL Server Language record name.. + /// + internal static string DbConnectionString_CurrentLanguage { + get { + return ResourceManager.GetString("DbConnectionString_CurrentLanguage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates the name of the data source to connect to.. + /// + internal static string DbConnectionString_DataSource { + get { + return ResourceManager.GetString("DbConnectionString_DataSource", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When true, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed.. + /// + internal static string DbConnectionString_Encrypt { + get { + return ResourceManager.GetString("DbConnectionString_Encrypt", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sessions in a Component Services (or MTS, if you are using Microsoft Windows NT) environment should automatically be enlisted in a global transaction where required.. + /// + internal static string DbConnectionString_Enlist { + get { + return ResourceManager.GetString("DbConnectionString_Enlist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The name or network address of the instance of SQL Server that acts as a failover partner.. + /// + internal static string DbConnectionString_FailoverPartner { + get { + return ResourceManager.GetString("DbConnectionString_FailoverPartner", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The name of the initial catalog or database in the data source.. + /// + internal static string DbConnectionString_InitialCatalog { + get { + return ResourceManager.GetString("DbConnectionString_InitialCatalog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Whether the connection is to be a secure connection or not.. + /// + internal static string DbConnectionString_IntegratedSecurity { + get { + return ResourceManager.GetString("DbConnectionString_IntegratedSecurity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed.. + /// + internal static string DbConnectionString_LoadBalanceTimeout { + get { + return ResourceManager.GetString("DbConnectionString_LoadBalanceTimeout", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The maximum number of connections allowed in the pool.. + /// + internal static string DbConnectionString_MaxPoolSize { + get { + return ResourceManager.GetString("DbConnectionString_MaxPoolSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The minimum number of connections allowed in the pool.. + /// + internal static string DbConnectionString_MinPoolSize { + get { + return ResourceManager.GetString("DbConnectionString_MinPoolSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When true, multiple result sets can be returned and read from one connection.. + /// + internal static string DbConnectionString_MultipleActiveResultSets { + get { + return ResourceManager.GetString("DbConnectionString_MultipleActiveResultSets", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If your application is connecting to a high-availability, disaster recovery (AlwaysOn) availability group (AG) on different subnets, MultiSubnetFailover=Yes configures SqlConnection to provide faster detection of and connection to the (currently) active server.. + /// + internal static string DbConnectionString_MultiSubnetFailover { + get { + return ResourceManager.GetString("DbConnectionString_MultiSubnetFailover", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Size in bytes of the network packets used to communicate with an instance of SQL Server.. + /// + internal static string DbConnectionString_PacketSize { + get { + return ResourceManager.GetString("DbConnectionString_PacketSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates the password to be used when connecting to the data source.. + /// + internal static string DbConnectionString_Password { + get { + return ResourceManager.GetString("DbConnectionString_Password", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.. + /// + internal static string DbConnectionString_PersistSecurityInfo { + get { + return ResourceManager.GetString("DbConnectionString_PersistSecurityInfo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Defines the blocking period behavior for a connection pool.. + /// + internal static string DbConnectionString_PoolBlockingPeriod { + get { + return ResourceManager.GetString("DbConnectionString_PoolBlockingPeriod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When true, the connection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool.. + /// + internal static string DbConnectionString_Pooling { + get { + return ResourceManager.GetString("DbConnectionString_Pooling", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Used by SQL Server in Replication.. + /// + internal static string DbConnectionString_Replication { + get { + return ResourceManager.GetString("DbConnectionString_Replication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates binding behavior of connection to a System.Transactions Transaction when enlisted.. + /// + internal static string DbConnectionString_TransactionBinding { + get { + return ResourceManager.GetString("DbConnectionString_TransactionBinding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When true (and encrypt=true), SQL Server uses SSL encryption for all data sent between the client and server without validating the server certificate.. + /// + internal static string DbConnectionString_TrustServerCertificate { + get { + return ResourceManager.GetString("DbConnectionString_TrustServerCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates which server type system the provider will expose through the DataReader.. + /// + internal static string DbConnectionString_TypeSystemVersion { + get { + return ResourceManager.GetString("DbConnectionString_TypeSystemVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates the user ID to be used when connecting to the data source.. + /// + internal static string DbConnectionString_UserID { + get { + return ResourceManager.GetString("DbConnectionString_UserID", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Indicates whether the connection will be re-directed to connect to an instance of SQL Server running under the user's account.. + /// + internal static string DbConnectionString_UserInstance { + get { + return ResourceManager.GetString("DbConnectionString_UserInstance", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The name of the workstation connecting to SQL Server.. + /// + internal static string DbConnectionString_WorkstationID { + get { + return ResourceManager.GetString("DbConnectionString_WorkstationID", resourceCulture); + } + } + /// /// Looks up a localized string similar to Internal error occurred when retrying the download of the HGS root certificate after the initial request failed. Contact Customer Support Services.. /// @@ -2796,15 +3156,6 @@ internal static string SQL_KerberosTicketMissingError { } } - /// - /// Looks up a localized string similar to Cannot use 'Authentication={0}' with 'Password' or 'PWD' connection string keywords.. - /// - internal static string SQL_NonInteractiveWithPassword { - get { - return ResourceManager.GetString("SQL_NonInteractiveWithPassword", resourceCulture); - } - } - /// /// Looks up a localized string similar to The connection does not support MultipleActiveResultSets.. /// @@ -2868,6 +3219,15 @@ internal static string SQL_NonCharColumn { } } + /// + /// Looks up a localized string similar to Cannot use 'Authentication={0}' with 'Password' or 'PWD' connection string keywords.. + /// + internal static string SQL_NonInteractiveWithPassword { + get { + return ResourceManager.GetString("SQL_NonInteractiveWithPassword", resourceCulture); + } + } + /// /// Looks up a localized string similar to SSE Instance re-direction is not supported for non-local user instances.. /// @@ -4442,12 +4802,33 @@ internal static string TCE_DbConnectionString_AttestationProtocol { return ResourceManager.GetString("TCE_DbConnectionString_AttestationProtocol", resourceCulture); } } - + /// - /// Looks up a localized string similar to Specifies an IP address preference when connecting to SQL instances. + /// Looks up a localized string similar to Default column encryption setting for all the commands on the connection.. /// - internal static string TCE_DbConnectionString_IPAddressPreference - => ResourceManager.GetString("TCE_DbConnectionString_IPAddressPreference", resourceCulture); + internal static string TCE_DbConnectionString_ColumnEncryptionSetting { + get { + return ResourceManager.GetString("TCE_DbConnectionString_ColumnEncryptionSetting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specifies an endpoint of an enclave attestation service, which will be used to verify whether the enclave, configured in the SQL Server instance for computations on database columns encrypted using Always Encrypted, is valid and secure.. + /// + internal static string TCE_DbConnectionString_EnclaveAttestationUrl { + get { + return ResourceManager.GetString("TCE_DbConnectionString_EnclaveAttestationUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specifies an IP address preference when connecting to SQL instances.. + /// + internal static string TCE_DbConnectionString_IPAddressPreference { + get { + return ResourceManager.GetString("TCE_DbConnectionString_IPAddressPreference", resourceCulture); + } + } /// /// Looks up a localized string similar to Decryption failed. The last 10 bytes of the encrypted column encryption key are: '{0}'. The first 10 bytes of ciphertext are: '{1}'.. diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx index 14a70b74a3..30047b1c8f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx @@ -1932,4 +1932,130 @@ '{0}' is not less than '{1}'; '{2}' cannot be greater than '{3}'. + + Advanced + + + Connection Resiliency + + + Context + + + Initialization + + + Pooling + + + Replication + + + Security + + + Source + + + Time to wait for command to execute. + + + Declares the application workload type when connecting to a server. + + + The name of the application. + + + The name of the primary file, including the full path name, of an attachable database. + + + Specifies the method of authenticating with SQL Server. + + + Number of attempts to restore connection. + + + Delay between attempts to restore connection. + + + The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. + + + The SQL Server Language record name. + + + Indicates the name of the data source to connect to. + + + When true, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed. + + + Sessions in a Component Services (or MTS, if you are using Microsoft Windows NT) environment should automatically be enlisted in a global transaction where required. + + + The name or network address of the instance of SQL Server that acts as a failover partner. + + + The name of the initial catalog or database in the data source. + + + Whether the connection is to be a secure connection or not. + + + The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed. + + + The maximum number of connections allowed in the pool. + + + The minimum number of connections allowed in the pool. + + + When true, multiple result sets can be returned and read from one connection. + + + If your application is connecting to a high-availability, disaster recovery (AlwaysOn) availability group (AG) on different subnets, MultiSubnetFailover=Yes configures SqlConnection to provide faster detection of and connection to the (currently) active server. + + + Size in bytes of the network packets used to communicate with an instance of SQL Server. + + + Indicates the password to be used when connecting to the data source. + + + When false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. + + + Defines the blocking period behavior for a connection pool. + + + When true, the connection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool. + + + Used by SQL Server in Replication. + + + Indicates binding behavior of connection to a System.Transactions Transaction when enlisted. + + + When true (and encrypt=true), SQL Server uses SSL encryption for all data sent between the client and server without validating the server certificate. + + + Indicates which server type system the provider will expose through the DataReader. + + + Indicates the user ID to be used when connecting to the data source. + + + Indicates whether the connection will be re-directed to connect to an instance of SQL Server running under the user's account. + + + The name of the workstation connecting to SQL Server. + + + Default column encryption setting for all the commands on the connection. + + + Specifies an endpoint of an enclave attestation service, which will be used to verify whether the enclave, configured in the SQL Server instance for computations on database columns encrypted using Always Encrypted, is valid and secure. + \ No newline at end of file diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs b/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs index 7aa8a4dc6b..cce4bb6f61 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs @@ -8,7 +8,7 @@ using System.Runtime.CompilerServices; using System.Threading; -namespace Microsoft.Data +namespace System { internal partial class StringsHelper : Strings { diff --git a/src/Microsoft.Data.SqlClient/netcore/tools/scripts/GenerateResourceStringsSource.ps1 b/src/Microsoft.Data.SqlClient/netcore/tools/scripts/GenerateResourceStringsSource.ps1 new file mode 100644 index 0000000000..c4ffbb6deb --- /dev/null +++ b/src/Microsoft.Data.SqlClient/netcore/tools/scripts/GenerateResourceStringsSource.ps1 @@ -0,0 +1,52 @@ +# Script: GenerateResourceStringsSource.ps1 +# Author: Keerat Singh +# Date: 25-Jan-2019 +# Comments: This Reads the resources from the resx file and converts them +# into strongly typed const strings +# + +param( + [Parameter(Mandatory=$true)] + [string]$ResxFileDir, + [Parameter(Mandatory=$true)] + [string]$ResxFileName, + [Parameter(Mandatory=$true)] + [string]$OutputPath, + [string]$GeneratedSourceFileName + ) + +# Read the resx file +$XmlFilePath = "${ResxFileDir}${ResxFileName}.resx" +[xml]$XmlDocument = Get-Content -Path "$XmlFilePath" + +# Initial content for the Source File. +$GeneratedSourceFileContent= " +//------------------------------------------------------------------------------ +// This code was auto-generated by msbuild target. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +//------------------------------------------------------------------------------ + +using System; +using System.Globalization; +using System.Resources; +using System.Threading; + +namespace System +{ + internal partial class StringsHelper : $ResxFileName + { + internal class ResourceNames + {`n" +ForEach($node in $XmlDocument.root.data) +{ + $ResourceName = $node.name + # Escape the Double Quotes in the resource string value. + $ResourceValue = $node.value -replace '"','""' + # Convert Resource Name and Value to internal const string + $GeneratedSourceFileContent= $GeneratedSourceFileContent + " internal const string $ResourceName = @`"$ResourceValue`";`n" +} + +$GeneratedSourceFileContent= $GeneratedSourceFileContent + " }`n}`n}" + +# Output to File +$GeneratedSourceFileContent | Out-File "${OutputPath}${GeneratedSourceFileName}" diff --git a/src/Microsoft.Data.SqlClient/netcore/tools/targets/GenerateResourceStringsSource.targets b/src/Microsoft.Data.SqlClient/netcore/tools/targets/GenerateResourceStringsSource.targets new file mode 100644 index 0000000000..de27d71cfa --- /dev/null +++ b/src/Microsoft.Data.SqlClient/netcore/tools/targets/GenerateResourceStringsSource.targets @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 75a964c744..bf8ef7d4d6 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -619,7 +619,7 @@ - + diff --git a/tools/scripts/GenerateResourceStringsSource.ps1 b/src/Microsoft.Data.SqlClient/netfx/tools/scripts/GenerateResourceStringsSource.ps1 similarity index 99% rename from tools/scripts/GenerateResourceStringsSource.ps1 rename to src/Microsoft.Data.SqlClient/netfx/tools/scripts/GenerateResourceStringsSource.ps1 index cb98822e97..626d716fcb 100644 --- a/tools/scripts/GenerateResourceStringsSource.ps1 +++ b/src/Microsoft.Data.SqlClient/netfx/tools/scripts/GenerateResourceStringsSource.ps1 @@ -49,4 +49,4 @@ ForEach($node in $XmlDocument.root.data) $GeneratedSourceFileContent= $GeneratedSourceFileContent + " }`n}`n}" # Output to File -$GeneratedSourceFileContent | Out-File "${OutputPath}${GeneratedSourceFileName}" \ No newline at end of file +$GeneratedSourceFileContent | Out-File "${OutputPath}${GeneratedSourceFileName}" diff --git a/tools/targets/GenerateResourceStringsSource.targets b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets similarity index 64% rename from tools/targets/GenerateResourceStringsSource.targets rename to src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets index 62b05b97c3..195e3fef72 100644 --- a/tools/targets/GenerateResourceStringsSource.targets +++ b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets @@ -2,7 +2,7 @@ + -command "&$(NetFxSource)tools\scripts\GenerateResourceStringsSource.ps1 -ResxFileDir '$(NetFxResources)' -ResxFileName '$(ResxFileName)' -OutputPath '$(IntermediateOutputPath)' -GeneratedSourceFileName '$(GeneratedSourceFileName)'"" /> diff --git a/tools/targets/GenerateAssemblyInfo.targets b/tools/targets/GenerateAssemblyInfo.targets deleted file mode 100644 index 541cb245a6..0000000000 --- a/tools/targets/GenerateAssemblyInfo.targets +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/targets/GenerateAssemblyRef.targets b/tools/targets/GenerateAssemblyRef.targets deleted file mode 100644 index 618d30af8b..0000000000 --- a/tools/targets/GenerateAssemblyRef.targets +++ /dev/null @@ -1,31 +0,0 @@ - - - - - $(NetFxSource)src\System\Data\SqlClient\ - %20%20%20%20 - - - - - - - - - - - - - - - - - - - - - - - - -