From 4c3847cc6b4dde9adccf855be2d51758257f0d7d Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Thu, 8 Jul 2021 15:20:01 -0700 Subject: [PATCH] address review comments --- src/Directory.Build.props | 1 + .../src/Microsoft.Data.SqlClient.csproj | 6 + .../SqlConnectionStringBuilder.NetCoreApp.cs | 6 + .../SqlClient/SqlConnectionStringBuilder.cs | 150 ++++++- .../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 + .../src/Resources/ResDescriptionAttribute.cs | 45 ++ 10 files changed, 790 insertions(+), 16 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 create mode 100644 src/Microsoft.Data.SqlClient/src/Resources/ResDescriptionAttribute.cs diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 6acb394869..983cafb5dd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -42,6 +42,7 @@ $(Artifacts)tools\ $(ProjectDir)Microsoft.Data.SqlClient\ $(ManagedSourceCode)netcore\ + $(ManagedSourceCode)netcore\src\Resources\ $(ManagedSourceCode)netfx\ $(ManagedSourceCode)netfx\src\Resources\ $(ManagedSourceCode)add-ons\ 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 c5fa057a37..380205196f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -18,6 +18,8 @@ $(OutputPath)\$(TargetFramework)\Microsoft.Data.SqlClient.xml true Core $(BaseProduct) + Strings + $(ResxFileName).ResourceNames.cs $(DefineConstants);NETCOREAPP; @@ -327,6 +329,9 @@ Resources\ResCategoryAttribute.cs + + Resources\ResDescriptionAttribute.cs + @@ -873,4 +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 cbf55f7a8c..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,8 @@ // 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; using Microsoft.Data.Common; @@ -24,6 +26,10 @@ private static PoolBlockingPeriod ConvertToPoolBlockingPeriod(string keyword, ob } /// + [DisplayNameAttribute(DbConnectionStringKeywords.PoolBlockingPeriod)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_PoolBlockingPeriod)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public PoolBlockingPeriod PoolBlockingPeriod { get { return _poolBlockingPeriod; } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs index 4a850575a8..e539381bb7 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs @@ -16,6 +16,7 @@ namespace Microsoft.Data.SqlClient { /// + [DefaultPropertyAttribute(DbConnectionStringKeywords.DataSource)] public sealed partial class SqlConnectionStringBuilder : DbConnectionStringBuilder { private enum Keywords @@ -335,7 +336,9 @@ public override object this[string keyword] IPAddressPreference = ConvertToIPAddressPreference(keyword, value); break; #if NETCOREAPP - case Keywords.PoolBlockingPeriod: PoolBlockingPeriod = ConvertToPoolBlockingPeriod(keyword, value); break; + case Keywords.PoolBlockingPeriod: + PoolBlockingPeriod = ConvertToPoolBlockingPeriod(keyword, value); + break; #endif case Keywords.Encrypt: Encrypt = ConvertToBoolean(value); @@ -384,6 +387,10 @@ public override object this[string keyword] } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ApplicationIntent)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Initialization)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_ApplicationIntent)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public ApplicationIntent ApplicationIntent { get { return _applicationIntent; } @@ -400,6 +407,10 @@ public ApplicationIntent ApplicationIntent } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ApplicationName)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Context)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_ApplicationName)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string ApplicationName { get { return _applicationName; } @@ -411,6 +422,11 @@ public string ApplicationName } /// + [DisplayNameAttribute(DbConnectionStringKeywords.AttachDBFilename)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_AttachDBFilename)] + [EditorAttribute("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string AttachDBFilename { get { return _attachDBFilename; } @@ -422,6 +438,10 @@ public string AttachDBFilename } /// + [DisplayNameAttribute(DbConnectionStringKeywords.CommandTimeout)] + [ResCategory(StringsHelper.ResourceNames.DataCategory_Initialization)] + [ResDescription(StringsHelper.ResourceNames.DbCommand_CommandTimeout)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int CommandTimeout { get { return _commandTimeout; } @@ -437,6 +457,10 @@ public int CommandTimeout } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ConnectTimeout)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Initialization)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_ConnectTimeout)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int ConnectTimeout { get { return _connectTimeout; } @@ -452,6 +476,10 @@ public int ConnectTimeout } /// + [DisplayNameAttribute(DbConnectionStringKeywords.CurrentLanguage)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Initialization)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_CurrentLanguage)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string CurrentLanguage { get { return _currentLanguage; } @@ -463,6 +491,10 @@ public string CurrentLanguage } /// + [DisplayNameAttribute(DbConnectionStringKeywords.DataSource)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_DataSource)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string DataSource { get { return _dataSource; } @@ -474,6 +506,10 @@ public string DataSource } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Encrypt)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Encrypt)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool Encrypt { get { return _encrypt; } @@ -485,6 +521,10 @@ public bool Encrypt } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ColumnEncryptionSetting)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.TCE_DbConnectionString_ColumnEncryptionSetting)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting { get { return _columnEncryptionSetting; } @@ -501,6 +541,10 @@ public SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting } /// + [DisplayNameAttribute(DbConnectionStringKeywords.EnclaveAttestationUrl)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.TCE_DbConnectionString_EnclaveAttestationUrl)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string EnclaveAttestationUrl { get { return _enclaveAttestationUrl; } @@ -512,6 +556,10 @@ public string EnclaveAttestationUrl } /// + [DisplayNameAttribute(DbConnectionStringKeywords.AttestationProtocol)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.TCE_DbConnectionString_AttestationProtocol)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public SqlConnectionAttestationProtocol AttestationProtocol { get { return _attestationProtocol; } @@ -528,6 +576,10 @@ public SqlConnectionAttestationProtocol AttestationProtocol } /// + [DisplayNameAttribute(DbConnectionStringKeywords.IPAddressPreference)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.TCE_DbConnectionString_IPAddressPreference)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public SqlConnectionIPAddressPreference IPAddressPreference { get => _ipAddressPreference; @@ -544,6 +596,10 @@ public SqlConnectionIPAddressPreference IPAddressPreference } /// + [DisplayNameAttribute(DbConnectionStringKeywords.TrustServerCertificate)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_TrustServerCertificate)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool TrustServerCertificate { get { return _trustServerCertificate; } @@ -555,6 +611,10 @@ public bool TrustServerCertificate } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Enlist)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Enlist)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool Enlist { get { return _enlist; } @@ -566,6 +626,10 @@ public bool Enlist } /// + [DisplayNameAttribute(DbConnectionStringKeywords.FailoverPartner)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_FailoverPartner)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string FailoverPartner { get { return _failoverPartner; } @@ -577,6 +641,10 @@ public string FailoverPartner } /// + [DisplayNameAttribute(DbConnectionStringKeywords.InitialCatalog)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_InitialCatalog)] + [RefreshPropertiesAttribute(RefreshProperties.All)] [TypeConverter(typeof(SqlInitialCatalogConverter))] public string InitialCatalog { @@ -589,6 +657,10 @@ public string InitialCatalog } /// + [DisplayNameAttribute(DbConnectionStringKeywords.IntegratedSecurity)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_IntegratedSecurity)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool IntegratedSecurity { get { return _integratedSecurity; } @@ -600,6 +672,10 @@ public bool IntegratedSecurity } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Authentication)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Authentication)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public SqlAuthenticationMethod Authentication { get { return _authentication; } @@ -616,6 +692,10 @@ public SqlAuthenticationMethod Authentication } /// + [DisplayNameAttribute(DbConnectionStringKeywords.LoadBalanceTimeout)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_LoadBalanceTimeout)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int LoadBalanceTimeout { get { return _loadBalanceTimeout; } @@ -631,6 +711,10 @@ public int LoadBalanceTimeout } /// + [DisplayNameAttribute(DbConnectionStringKeywords.MaxPoolSize)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_MaxPoolSize)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int MaxPoolSize { get { return _maxPoolSize; } @@ -646,6 +730,10 @@ public int MaxPoolSize } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ConnectRetryCount)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_ConnectionResilency)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_ConnectRetryCount)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int ConnectRetryCount { get { return _connectRetryCount; } @@ -661,6 +749,10 @@ public int ConnectRetryCount } /// + [DisplayNameAttribute(DbConnectionStringKeywords.ConnectRetryInterval)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_ConnectionResilency)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_ConnectRetryInterval)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int ConnectRetryInterval { get { return _connectRetryInterval; } @@ -677,6 +769,10 @@ public int ConnectRetryInterval /// + [DisplayNameAttribute(DbConnectionStringKeywords.MinPoolSize)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_MinPoolSize)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int MinPoolSize { get { return _minPoolSize; } @@ -692,6 +788,10 @@ public int MinPoolSize } /// + [DisplayNameAttribute(DbConnectionStringKeywords.MultipleActiveResultSets)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Advanced)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_MultipleActiveResultSets)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool MultipleActiveResultSets { get { return _multipleActiveResultSets; } @@ -704,6 +804,10 @@ public bool MultipleActiveResultSets /// [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "Reviewed and Approved by UE")] + [DisplayNameAttribute(DbConnectionStringKeywords.MultiSubnetFailover)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_MultiSubnetFailover)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool MultiSubnetFailover { get { return _multiSubnetFailover; } @@ -728,6 +832,10 @@ public string NamedConnection { } */ /// + [DisplayNameAttribute(DbConnectionStringKeywords.PacketSize)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Advanced)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_PacketSize)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public int PacketSize { get { return _packetSize; } @@ -743,6 +851,11 @@ public int PacketSize } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Password)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Password)] + [PasswordPropertyTextAttribute(true)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string Password { get { return _password; } @@ -754,6 +867,10 @@ public string Password } /// + [DisplayNameAttribute(DbConnectionStringKeywords.PersistSecurityInfo)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_PersistSecurityInfo)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool PersistSecurityInfo { get { return _persistSecurityInfo; } @@ -765,6 +882,10 @@ public bool PersistSecurityInfo } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Pooling)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Pooling)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Pooling)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool Pooling { get { return _pooling; } @@ -776,6 +897,10 @@ public bool Pooling } /// + [DisplayNameAttribute(DbConnectionStringKeywords.Replication)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Replication)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_Replication)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool Replication { get { return _replication; } @@ -787,6 +912,10 @@ public bool Replication } /// + [DisplayNameAttribute(DbConnectionStringKeywords.TransactionBinding)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Advanced)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_TransactionBinding)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string TransactionBinding { get { return _transactionBinding; } @@ -798,6 +927,10 @@ public string TransactionBinding } /// + [DisplayNameAttribute(DbConnectionStringKeywords.TypeSystemVersion)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Advanced)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_TypeSystemVersion)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string TypeSystemVersion { get { return _typeSystemVersion; } @@ -809,6 +942,10 @@ public string TypeSystemVersion } /// + [DisplayNameAttribute(DbConnectionStringKeywords.UserID)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Security)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_UserID)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string UserID { get { return _userID; } @@ -820,6 +957,10 @@ public string UserID } /// + [DisplayNameAttribute(DbConnectionStringKeywords.UserInstance)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_UserInstance)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public bool UserInstance { get { return _userInstance; } @@ -831,6 +972,10 @@ public bool UserInstance } /// + [DisplayNameAttribute(DbConnectionStringKeywords.WorkstationID)] + [ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Context)] + [ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_WorkstationID)] + [RefreshPropertiesAttribute(RefreshProperties.All)] public string WorkstationID { get { return _workstationID; } @@ -947,7 +1092,8 @@ private object GetAt(Keywords index) case Keywords.AttachDBFilename: return AttachDBFilename; #if NETCOREAPP - case Keywords.PoolBlockingPeriod: return PoolBlockingPeriod; + case Keywords.PoolBlockingPeriod: + return PoolBlockingPeriod; #endif case Keywords.CommandTimeout: return CommandTimeout; 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 5f81a9cbcc..9e3bf7b83c 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.. /// @@ -4451,12 +4811,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 4dff81e444..aca7b1efbe 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx @@ -1935,4 +1935,130 @@ Parameter '{0}' cannot have Direction Output or InputOutput when EnableOptimizedParameterBinding is enabled on the parent command. + + 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. + + + 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. + + + Indicates binding behavior of connection to a System.Transactions Transaction when enlisted. + \ 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 1a12852bc7..f914064f5f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Resources/StringsHelper.cs @@ -9,7 +9,7 @@ namespace System { - internal class StringsHelper : Strings + internal partial class StringsHelper : Strings { static StringsHelper loader = null; ResourceManager resources; 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/src/Resources/ResDescriptionAttribute.cs b/src/Microsoft.Data.SqlClient/src/Resources/ResDescriptionAttribute.cs new file mode 100644 index 0000000000..4951439223 --- /dev/null +++ b/src/Microsoft.Data.SqlClient/src/Resources/ResDescriptionAttribute.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.Data +{ + using System; + using System.ComponentModel; + + [AttributeUsage(AttributeTargets.All)] + internal sealed class ResDescriptionAttribute : DescriptionAttribute + { + + private bool replaced = false; + + /// + /// Constructs a new sys description. + /// + /// + /// description text. + /// + public ResDescriptionAttribute(string description) : base(description) + { + } + + /// + /// Retrieves the description text. + /// + /// + /// description + /// + public override string Description + { + get + { + if (!replaced) + { + replaced = true; + DescriptionValue = StringsHelper.GetString(base.Description); + } + return base.Description; + } + } + } +}