diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml index 6eddd8df55..ed55b961ed 100644 --- a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml +++ b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml @@ -476,7 +476,8 @@ The connection string contains . Gets or sets the string used to open a SQL Server database. The connection string that includes the source database name, and other parameters needed to establish the initial connection. The default value is an empty string. - + is similar to an OLE DB connection string, but is not identical. Unlike OLE DB or ADO, the connection string that is returned is the same as the user-set , minus security information if the Persist Security Info value is set to `false` (default). The .NET Framework Data Provider for SQL Server does not persist or return the password in a connection string unless you set Persist Security Info to `true`. @@ -510,18 +511,20 @@ The connection string contains . |Address|N/A|Synonym of **Data Source**.| |App|N/A|Synonym of **Application Name**.| |Application Name|N/A|The name of the application, or '.NET SQLClient Data Provider' if no application name is provided.

An application name can be 128 characters or less.| -|ApplicationIntent|ReadWrite|Declares the application workload type when connecting to a server. Possible values are `ReadOnly` and `ReadWrite`. For example:

`ApplicationIntent=ReadOnly`

For more information about SqlClient support for Always On Availability Groups, see [SqlClient Support for High Availability, Disaster Recovery](~/docs/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery.md).| +|Application Intent

-or-

ApplicationIntent|ReadWrite|Declares the application workload type when connecting to a server. Possible values are `ReadOnly` and `ReadWrite`. For example:

`ApplicationIntent=ReadOnly`

For more information about SqlClient support for Always On Availability Groups, see [SqlClient Support for High Availability, Disaster Recovery](~/docs/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery.md).| |Asynchronous Processing

-or-

Async|'false'|When `true`, enables asynchronous operation support. Recognized values are `true`, `false`, `yes`, and `no`.

This property is ignored beginning in .NET Framework 4.5. For more information about SqlClient support for asynchronous programming, see [Asynchronous Programming](~/docs/framework/data/adonet/asynchronous-programming.md).| +|Attestation Protocol|N/A|Gets or sets the value of Attestation Protocol.

Valid values are:
`AAS`
`HGS`| |AttachDBFilename

-or-

Extended Properties

-or-

Initial File Name|N/A|The name of the primary database file, including the full path name of an attachable database. AttachDBFilename is only supported for primary data files with an .mdf extension.

If the value of the AttachDBFileName key is specified in the connection string, the database is attached and becomes the default database for the connection.

If this key is not specified and if the database was previously attached, the database will not be reattached. The previously attached database will be used as the default database for the connection.

If this key is specified together with the AttachDBFileName key, the value of this key will be used as the alias. However, if the name is already used in another attached database, the connection will fail.

The path may be absolute or relative by using the DataDirectory substitution string. If DataDirectory is used, the database file must exist within a subdirectory of the directory pointed to by the substitution string. **Note:** Remote server, HTTP, and UNC path names are not supported.

The database name must be specified with the keyword 'database' (or one of its aliases) as in the following:

"AttachDbFileName=|DataDirectory|\data\YourDB.mdf;integrated security=true;database=YourDatabase"

An error will be generated if a log file exists in the same directory as the data file and the 'database' keyword is used when attaching the primary data file. In this case, remove the log file. Once the database is attached, a new log file will be automatically generated based on the physical path.| -|Authentication|N/A|The authentication method used for [Connecting to SQL Database By Using Azure Active Directory Authentication](https://azure.microsoft.com/documentation/articles/sql-database-aad-authentication/#7-connect-to-your-database-by-using-azure-active-directory-identities).

Valid values are:

`Active Directory Integrated`, `Active Directory Interactive`, `Active Directory Password`, `Sql Password`. Currently `Active Directory Integrated` and `Active Directory Interactive` modes of authentication are only supported for .NET Framework. | +|Authentication|N/A|The authentication method used for [Connecting to SQL Database By Using Azure Active Directory Authentication](https://azure.microsoft.com/documentation/articles/sql-database-aad-authentication/#7-connect-to-your-database-by-using-azure-active-directory-identities).

Valid values are:

`Active Directory Integrated`, `Active Directory Interactive`, `Active Directory Password`, `Sql Password`. Currently `Active Directory Integrated` and `Active Directory Interactive` modes of authentication are supported only for .NET Framework. | |Column Encryption Setting|N/A|Enables or disables [Always Encrypted](/sql/relational-databases/security/encryption/always-encrypted-database-engine?view=sql-server-2017) functionality for the connection.| |Connect Timeout

-or-

Connection Timeout

-or-

Timeout|15|The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

Valid values are greater than or equal to 0 and less than or equal to 2147483647.

When opening a connection to a Azure SQL Database, set the connection timeout to 30 seconds.| |Connection Lifetime

-or-

Load Balance Timeout|0|When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by `Connection Lifetime`. This is useful in clustered configurations to force load balancing between a running server and a server just brought online.

A value of zero (0) causes pooled connections to have the maximum connection timeout.| -|ConnectRetryCount|1|Controls the number of reconnection attempts after the client identifies an idle connection failure. Valid values are 0 to 255. The default is 1. 0 means do not attempt to reconnect (disable connection resiliency).

For additional information about idle connection resiliency, see [Technical Article - Idle Connection Resiliency](https://go.microsoft.com/fwlink/?LinkId=393996).| -|ConnectRetryInterval|10|Specifies the time between each connection retry attempt (ConnectRetryCount). Valid values are 1 to 60 seconds (default=10), applied after the first reconnection attempt. When a broken connection is detected, the client immediately attempts to reconnect; this is the first reconnection attempt and only occurs if ConnectRetryCount is greater than 0. If the first reconnection attempt fails and ConnectRetryCount is greater than 1, the client waits ConnectRetryInterval to try the second and subsequent reconnection attempts.

For additional information about idle connection resiliency, see [Technical Article - Idle Connection Resiliency](https://go.microsoft.com/fwlink/?LinkId=393996).| +|Connect Retry Count

-or-

ConnectRetryCount|1|Controls the number of reconnection attempts after the client identifies an idle connection failure. Valid values are 0 to 255. The default is 1. 0 means do not attempt to reconnect (disable connection resiliency).

For additional information about idle connection resiliency, see [Technical Article - Idle Connection Resiliency](https://go.microsoft.com/fwlink/?LinkId=393996).| +|Connect Retry Interval

-or-

ConnectRetryInterval|10|Specifies the time between each connection retry attempt (ConnectRetryCount). Valid values are 1 to 60 seconds (default=10), applied after the first reconnection attempt. When a broken connection is detected, the client immediately attempts to reconnect; this is the first reconnection attempt and only occurs if ConnectRetryCount is greater than 0. If the first reconnection attempt fails and ConnectRetryCount is greater than 1, the client waits ConnectRetryInterval to try the second and subsequent reconnection attempts.

For additional information about idle connection resiliency, see [Technical Article - Idle Connection Resiliency](https://go.microsoft.com/fwlink/?LinkId=393996).| |Context Connection|'false'|`true` if an in-process connection to SQL Server should be made.| |Current Language

-or-

Language|N/A|Sets the language used for database server warning or error messages.

The language name can be 128 characters or less.| |Data Source

-or-

Server

-or-

Address

-or-

Addr

-or-

Network Address|N/A|The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name:

`server=tcp:servername, portnumber`

When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes:

`np:(local), tcp:(local), lpc:(local)`

Beginning in .NET Framework 4.5, you can also connect to a LocalDB database as follows:

`server=(localdb)\\myInstance`

For more information about LocalDB, see [SqlClient Support for LocalDB](~/docs/framework/data/adonet/sql/sqlclient-support-for-localdb.md).

**Data Source** must use the TCP format or the Named Pipes format.

TCP format is as follows:

- tcp:\\\
- tcp:\,\

The TCP format must start with the prefix "tcp:" and is followed by the database instance, as specified by a host name and an instance name. This format is not applicable when connecting to Azure SQL Database. TCP is automatically selected for connections to Azure SQL Database when no protocol is specified.

The host name MUST be specified in one of the following ways:

- NetBIOSName
- IPv4Address
- IPv6Address

The instance name is used to resolve to a particular TCP/IP port number on which a database instance is hosted. Alternatively, specifying a TCP/IP port number directly is also allowed. If both instance name and port number are not present, the default database instance is used.

The Named Pipes format is as follows:

- np:\\\\\pipe\\

The Named Pipes format MUST start with the prefix "np:" and is followed by a named pipe name.

The host name MUST be specified in one of the following ways:

- NetBIOSName
- IPv4Address
- IPv6Address

The pipe name is used to identify the database instance to which the .NET Framework application will be connected.

If the value of the **Network** key is specified, the prefixes "tcp:" and "np:" should not be specified. **Note:** You can force the use of TCP instead of shared memory, either by prefixing **tcp:** to the server name in the connection string, or by using **localhost**.| +|Enclave Attestation Url|N/A|Gets or sets the enclave attestation Url to be used with enclave based Always Encrypted.| |Encrypt|'false'|When `true`, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed. Recognized values are `true`, `false`, `yes`, and `no`. For more information, see [Connection String Syntax](~/docs/framework/data/adonet/connection-string-syntax.md).

Beginning in .NET Framework 4.5, when `TrustServerCertificate` is false and `Encrypt` is true, the server name (or IP address) in a SQL Server SSL certificate must exactly match the server name (or IP address) specified in the connection string. Otherwise, the connection attempt will fail. For information about support for certificates whose subject starts with a wildcard character (*), see [Accepted wildcards used by server certificates for server authentication](https://support.microsoft.com/kb/258858).| |Enlist|'true'|`true` indicates that the SQL Server connection pooler automatically enlists the connection in the creation thread's current transaction context.| |Failover Partner|N/A|The name of the failover partner server where database mirroring is configured.

If the value of this key is "", then **Initial Catalog** must be present, and its value must not be "".

The server name can be 128 characters or less.

If you specify a failover partner but the failover partner server is not configured for database mirroring and the primary server (specified with the Server keyword) is not available, then the connection will fail.

If you specify a failover partner and the primary server is not configured for database mirroring, the connection to the primary server (specified with the Server keyword) will succeed if the primary server is available.| @@ -529,18 +532,18 @@ The connection string contains . |Integrated Security

-or-

Trusted_Connection|'false'|When `false`, User ID and Password are specified in the connection. When `true`, the current Windows account credentials are used for authentication.

Recognized values are `true`, `false`, `yes`, `no`, and `sspi` (strongly recommended), which is equivalent to `true`.

If User ID and Password are specified and Integrated Security is set to true, the User ID and Password will be ignored and Integrated Security will be used.

is a more secure way to specify credentials for a connection that uses SQL Server Authentication (`Integrated Security=false`).| |Max Pool Size|100|The maximum number of connections that are allowed in the pool.

Valid values are greater than or equal to 1. Values that are less than **Min Pool Size** generate an error.| |Min Pool Size|0|The minimum number of connections that are allowed in the pool.

Valid values are greater than or equal to 0. Zero (0) in this field means no minimum connections are initially opened.

Values that are greater than **Max Pool Size** generate an error.| -|MultipleActiveResultSets|'false'|When `true`, an application can maintain multiple active result sets (MARS). When `false`, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

Recognized values are `true` and `false`.

For more information, see [Multiple Active Result Sets (MARS)](~/docs/framework/data/adonet/sql/multiple-active-result-sets-mars.md).| -|`MultiSubnetFailover`|FALSE|Always specify `multiSubnetFailover=True` when connecting to the availability group listener of a SQL Server 2012 (or later) availability group or a SQL Server 2012 (or later) Failover Cluster Instance. `multiSubnetFailover=True` configures SqlClient to provide faster detection of and connection to the (currently) active server. Possible values are `Yes` and `No`, `True` and `False` or `1` and `0`. For example:

`MultiSubnetFailover=True`

The default is `False`. For more information about SqlClient's support for Always On AGs, see [SqlClient Support for High Availability, Disaster Recovery](~/docs/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery.md).| +|Multiple Active Result Sets

-or-

MultipleActiveResultSets|false|When `true`, an application can maintain multiple active result sets (MARS). When `false`, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

Recognized values are `true` and `false`.

For more information, see [Multiple Active Result Sets (MARS)](~/docs/framework/data/adonet/sql/multiple-active-result-sets-mars.md).| +|Multi Subnet Failover

-or-

MultiSubnetFailover|false|Always specify `multiSubnetFailover=True` when connecting to the availability group listener of a SQL Server 2012 (or later) availability group or a SQL Server 2012 (or later) Failover Cluster Instance. `multiSubnetFailover=True` configures SqlClient to provide faster detection of and connection to the (currently) active server. Possible values are `Yes` and `No`, `True` and `False` or `1` and `0`. For example:

`MultiSubnetFailover=True`

The default is `False`. For more information about SqlClient's support for Always On AGs, see [SqlClient Support for High Availability, Disaster Recovery](~/docs/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery.md).| |Network Library

-or-

Network

-or-

Net|N/A|The network library used to establish a connection to an instance of SQL Server. Supported values include:

dbnmpntw (Named Pipes)

dbmsrpcn (Multiprotocol, Windows RPC)

dbmsadsn (Apple Talk)

dbmsgnet (VIA)

dbmslpcn (Shared Memory)

dbmsspxn (IPX/SPX)

dbmssocn (TCP/IP)

Dbmsvinn (Banyan Vines)

The corresponding network DLL must be installed on the system to which you connect. If you do not specify a network and you use a local server (for example, "." or "(local)"), shared memory is used. In this example, the network library is Win32 Winsock TCP/IP (dbmssocn), and 1433 is the port being used.

`Network Library=dbmssocn;Data Source=000.000.000.000,1433;`| |Packet Size|8000|Size in bytes of the network packets used to communicate with an instance of SQL Server.

The packet size can be greater than or equal to 512 and less than or equal to 32768.| |Password

-or-

PWD|N/A|The password for the SQL Server account logging on. Not recommended. To maintain a high level of security, we strongly recommend that you use the `Integrated Security` or `Trusted_Connection` keyword instead. is a more secure way to specify credentials for a connection that uses SQL Server Authentication.

The password must be 128 characters or less.| |Persist Security Info

-or-

PersistSecurityInfo|'false'|When set to `false` or `no` (strongly recommended), 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. Resetting the connection string resets all connection string values including the password. Recognized values are `true`, `false`, `yes`, and `no`.| -|PoolBlockingPeriod|Auto|Sets the blocking period behavior for a connection pool. See property for details.| +|Pool Blocking Period

-or-

PoolBlockingPeriod|Auto|Sets the blocking period behavior for a connection pool. See property for details.| |Pooling|'true'|When the value of this key is set to true, any newly created connection will be added to the pool when closed by the application. In a next attempt to open the same connection, that connection will be drawn from the pool.

Connections are considered the same if they have the same connection string. Different connections have different connection strings.

The value of this key can be "true", "false", "yes", or "no".| |Replication|'false'|`true` if replication is supported using the connection.| |Transaction Binding|Implicit Unbind|Controls connection association with an enlisted `System.Transactions` transaction.

Possible values are:

`Transaction Binding=Implicit Unbind;`

`Transaction Binding=Explicit Unbind;`

Implicit Unbind causes the connection to detach from the transaction when it ends. After detaching, additional requests on the connection are performed in autocommit mode. The `System.Transactions.Transaction.Current` property is not checked when executing requests while the transaction is active. After the transaction has ended, additional requests are performed in autocommit mode.

If the system ends the transaction (in the scope of a using block) before the last command completes, it will throw .

Explicit Unbind causes the connection to remain attached to the transaction until the connection is closed or an explicit `SqlConnection.TransactionEnlist(null)` is called. Beginning in .NET Framework 4.0, changes to Implicit Unbind make Explicit Unbind obsolete. An `InvalidOperationException` is thrown if `Transaction.Current` is not the enlisted transaction or if the enlisted transaction is not active.| -|TransparentNetworkIPResolution|See description.|When the value of this key is set to `true`, the application is required to retrieve all IP addresses for a particular DNS entry and attempt to connect with the first one in the list. If the connection is not established within 0.5 seconds, the application will try to connect to all others in parallel. When the first answers, the application will establish the connection with the respondent IP address.

If the `MultiSubnetFailover` key is set to `true`, `TransparentNetworkIPResolution` is ignored.

If the `Failover Partner` key is set, `TransparentNetworkIPResolution` is ignored.

The value of this key must be `true`, `false`, `yes`, or `no`.

A value of `yes` is treated the same as a value of `true`.

A value of `no` is treated the same as a value of `false`.

The default values are as follows:

  • `false` when:

    • Connecting to Azure SQL Database where the data source ends with:

      • .database.chinacloudapi.cn
      • .database.usgovcloudapi.net
      • .database.cloudapi.de
      • .database.windows.net
    • `Authentication` is 'Active Directory Password' or 'Active Directory Integrated'
  • `true` in all other cases.
| -|TrustServerCertificate|'false'|When set to `true`, SSL is used to encrypt the channel when bypassing walking the certificate chain to validate trust. If TrustServerCertificate is set to `true` and Encrypt is set to `false`, the channel is not encrypted. Recognized values are `true`, `false`, `yes`, and `no`. For more information, see [Connection String Syntax](~/docs/framework/data/adonet/connection-string-syntax.md).| +|Transparent Network IP Resolution

-or-

TransparentNetworkIPResolution|See description.|When the value of this key is set to `true`, the application is required to retrieve all IP addresses for a particular DNS entry and attempt to connect with the first one in the list. If the connection is not established within 0.5 seconds, the application will try to connect to all others in parallel. When the first answers, the application will establish the connection with the respondent IP address.

If the `MultiSubnetFailover` key is set to `true`, `TransparentNetworkIPResolution` is ignored.

If the `Failover Partner` key is set, `TransparentNetworkIPResolution` is ignored.

The value of this key must be `true`, `false`, `yes`, or `no`.

A value of `yes` is treated the same as a value of `true`.

A value of `no` is treated the same as a value of `false`.

The default values are as follows:

  • `false` when:

    • Connecting to Azure SQL Database where the data source ends with:

      • .database.chinacloudapi.cn
      • .database.usgovcloudapi.net
      • .database.cloudapi.de
      • .database.windows.net
    • `Authentication` is 'Active Directory Password' or 'Active Directory Integrated'
  • `true` in all other cases.
| +|Trust Server Certificate

-or-

TrustServerCertificate|'false'|When set to `true`, SSL is used to encrypt the channel when bypassing walking the certificate chain to validate trust. If TrustServerCertificate is set to `true` and Encrypt is set to `false`, the channel is not encrypted. Recognized values are `true`, `false`, `yes`, and `no`. For more information, see [Connection String Syntax](~/docs/framework/data/adonet/connection-string-syntax.md).| |Type System Version|N/A|A string value that indicates the type system the application expects. The functionality available to a client application is dependent on the version of SQL Server and the compatibility level of the database. Explicitly setting the type system version that the client application was written for avoids potential problems that could cause an application to break if a different version of SQL Server is used. **Note:** The type system version cannot be set for common language runtime (CLR) code executing in-process in SQL Server. For more information, see [SQL Server Common Language Runtime Integration](~/docs/framework/data/adonet/sql/sql-server-common-language-runtime-integration.md).

Possible values are:

`Type System Version=SQL Server 2012;`

`Type System Version=SQL Server 2008;`

`Type System Version=SQL Server 2005;`

`Type System Version=Latest;`

`Type System Version=SQL Server 2012;` specifies that the application will require version 11.0.0.0 of Microsoft.SqlServer.Types.dll. The other `Type System Version` settings will require version 10.0.0.0 of Microsoft.SqlServer.Types.dll.

`Latest` is obsolete and should not be used. `Latest` is equivalent to `Type System Version=SQL Server 2008;`.| |User ID

-or-

UID

-or-|N/A|The SQL Server login account. Not recommended. To maintain a high level of security, we strongly recommend that you use the `Integrated Security` or `Trusted_Connection` keywords instead. is a more secure way to specify credentials for a connection that uses SQL Server Authentication.

The user ID must be 128 characters or less.| |User Instance|'false'|A value that indicates whether to redirect the connection from the default SQL Server Express instance to a runtime-initiated instance running under the account of the caller.| diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.NetCoreApp.cs index 1820928d40..2a8787f487 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.NetCoreApp.cs @@ -48,13 +48,20 @@ public enum PoolBlockingPeriod public sealed partial class SqlConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder { /// + [System.ComponentModel.DisplayNameAttribute("Pool Blocking Period")] + [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public PoolBlockingPeriod PoolBlockingPeriod { get { throw null; } set { } } /// + [System.ComponentModel.DisplayNameAttribute("Column Encryption Setting")] + [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting { get { throw null; } set { } } /// + [System.ComponentModel.DisplayNameAttribute("Enclave Attestation Url")] + [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public string EnclaveAttestationUrl { get { throw null; } set { } } - /// + [System.ComponentModel.DisplayNameAttribute("Attestation Protocol")] + [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.SqlConnectionAttestationProtocol AttestationProtocol {get { throw null; } set { } } } /// diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs index 60fb125690..e454e75618 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs @@ -607,7 +607,7 @@ public SqlConnectionStringBuilder() { } /// public SqlConnectionStringBuilder(string connectionString) { } /// - [System.ComponentModel.DisplayNameAttribute("ApplicationIntent")] + [System.ComponentModel.DisplayNameAttribute("Application Intent")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.ApplicationIntent ApplicationIntent { get { throw null; } set { } } /// @@ -624,11 +624,11 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.SqlAuthenticationMethod Authentication { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("ConnectRetryCount")] + [System.ComponentModel.DisplayNameAttribute("Connect Retry Count")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int ConnectRetryCount { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("ConnectRetryInterval")] + [System.ComponentModel.DisplayNameAttribute("Connect Retry Interval")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int ConnectRetryInterval { get { throw null; } set { } } /// @@ -682,11 +682,11 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int MinPoolSize { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("MultipleActiveResultSets")] + [System.ComponentModel.DisplayNameAttribute("Multiple Active Result Sets")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool MultipleActiveResultSets { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("MultiSubnetFailover")] + [System.ComponentModel.DisplayNameAttribute("Multi Subnet Failover")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool MultiSubnetFailover { get { throw null; } set { } } /// @@ -715,7 +715,7 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public string TransactionBinding { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("TrustServerCertificate")] + [System.ComponentModel.DisplayNameAttribute("Trust Server Certificate")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool TrustServerCertificate { get { throw null; } set { } } /// diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/Common/DbConnectionStringCommon.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/Common/DbConnectionStringCommon.cs index 21afe69dd8..9c2f595481 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/Common/DbConnectionStringCommon.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/Common/DbConnectionStringCommon.cs @@ -677,7 +677,7 @@ internal static partial class DbConnectionStringKeywords // internal const string NamedConnection = "Named Connection"; // SqlClient - internal const string ApplicationIntent = "ApplicationIntent"; + internal const string ApplicationIntent = "Application Intent"; internal const string ApplicationName = "Application Name"; internal const string AsynchronousProcessing = "Asynchronous Processing"; internal const string AttachDBFilename = "AttachDbFilename"; @@ -688,18 +688,18 @@ internal static partial class DbConnectionStringKeywords internal const string Encrypt = "Encrypt"; internal const string FailoverPartner = "Failover Partner"; internal const string InitialCatalog = "Initial Catalog"; - internal const string MultipleActiveResultSets = "MultipleActiveResultSets"; - internal const string MultiSubnetFailover = "MultiSubnetFailover"; + internal const string MultipleActiveResultSets = "Multiple Active Result Sets"; + internal const string MultiSubnetFailover = "Multi Subnet Failover"; internal const string NetworkLibrary = "Network Library"; internal const string PacketSize = "Packet Size"; internal const string Replication = "Replication"; internal const string TransactionBinding = "Transaction Binding"; - internal const string TrustServerCertificate = "TrustServerCertificate"; + internal const string TrustServerCertificate = "Trust Server Certificate"; internal const string TypeSystemVersion = "Type System Version"; internal const string UserInstance = "User Instance"; internal const string WorkstationID = "Workstation ID"; - internal const string ConnectRetryCount = "ConnectRetryCount"; - internal const string ConnectRetryInterval = "ConnectRetryInterval"; + internal const string ConnectRetryCount = "Connect Retry Count"; + internal const string ConnectRetryInterval = "Connect Retry Interval"; internal const string Authentication = "Authentication"; internal const string ColumnEncryptionSetting = "Column Encryption Setting"; internal const string EnclaveAttestationUrl = "Enclave Attestation Url"; @@ -720,7 +720,7 @@ internal static partial class DbConnectionStringKeywords internal const string Pooling = "Pooling"; internal const string MinPoolSize = "Min Pool Size"; #if netcoreapp - internal const string PoolBlockingPeriod = "PoolBlockingPeriod"; + internal const string PoolBlockingPeriod = "Pool Blocking Period"; #endif } @@ -732,6 +732,9 @@ internal static class DbConnectionStringSynonyms //internal const string ApplicationName = APP; internal const string APP = "app"; + //internal const string ApplicationIntent = APPLICATIONINTENT; + internal const string APPLICATIONINTENT = "ApplicationIntent"; + //internal const string AttachDBFilename = EXTENDEDPROPERTIES+","+INITIALFILENAME; internal const string EXTENDEDPROPERTIES = "extended properties"; internal const string INITIALFILENAME = "initial file name"; @@ -740,6 +743,12 @@ internal static class DbConnectionStringSynonyms internal const string CONNECTIONTIMEOUT = "connection timeout"; internal const string TIMEOUT = "timeout"; + //internal const string ConnectRetryCount = CONNECTRETRYCOUNT; + internal const string CONNECTRETRYCOUNT = "ConnectRetryCount"; + + //internal const string ConnectRetryInterval = CONNECTRETRYINTERVAL; + internal const string CONNECTRETRYINTERVAL = "ConnectRetryInterval"; + //internal const string CurrentLanguage = LANGUAGE; internal const string LANGUAGE = "language"; @@ -759,10 +768,20 @@ internal static class DbConnectionStringSynonyms //internal const string LoadBalanceTimeout = ConnectionLifetime; internal const string ConnectionLifetime = "connection lifetime"; + //internal const string MultipleActiveResultSets = MULTIPLEACTIVERESULTSETS; + internal const string MULTIPLEACTIVERESULTSETS = "MultipleActiveResultSets"; + + //internal const string MultiSubnetFailover = MULTISUBNETFAILOVER; + internal const string MULTISUBNETFAILOVER = "MultiSubnetFailover"; + //internal const string NetworkLibrary = NET+","+NETWORK; internal const string NET = "net"; internal const string NETWORK = "network"; +#if netcoreapp + //internal const string PoolBlockingPeriod = POOLBLOCKINGPERIOD; + internal const string POOLBLOCKINGPERIOD = "PoolBlockingPeriod"; +#endif //internal const string Password = Pwd; internal const string Pwd = "pwd"; @@ -770,6 +789,9 @@ internal static class DbConnectionStringSynonyms //internal const string PersistSecurityInfo = PERSISTSECURITYINFO; internal const string PERSISTSECURITYINFO = "persistsecurityinfo"; + //internal const string TrustServerCertificate = TRUSTSERVERCERTIFICATE; + internal const string TRUSTSERVERCERTIFICATE = "TrustServerCertificate"; + //internal const string UserID = UID+","+User; internal const string UID = "uid"; internal const string User = "user"; diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index 6ae4e31272..9c1b07c8d8 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -57,12 +57,12 @@ internal static partial class DEFAULT // keys must be lowercase! internal static class KEY { - internal const string ApplicationIntent = "applicationintent"; + internal const string ApplicationIntent = "application intent"; internal const string Application_Name = "application name"; internal const string AsynchronousProcessing = "asynchronous processing"; internal const string AttachDBFilename = "attachdbfilename"; #if netcoreapp - internal const string PoolBlockingPeriod = "poolblockingperiod"; + internal const string PoolBlockingPeriod = "pool blocking period"; #endif internal const string ColumnEncryptionSetting = "column encryption setting"; internal const string EnclaveAttestationUrl = "enclave attestation url"; @@ -78,31 +78,32 @@ internal static class KEY internal const string Initial_Catalog = "initial catalog"; internal const string Integrated_Security = "integrated security"; internal const string Load_Balance_Timeout = "load balance timeout"; - internal const string MARS = "multipleactiveresultsets"; + internal const string MARS = "multiple active result sets"; internal const string Max_Pool_Size = "max pool size"; internal const string Min_Pool_Size = "min pool size"; - internal const string MultiSubnetFailover = "multisubnetfailover"; + internal const string MultiSubnetFailover = "multi subnet failover"; internal const string Network_Library = "network library"; internal const string Packet_Size = "packet size"; internal const string Password = "password"; internal const string Persist_Security_Info = "persist security info"; internal const string Pooling = "pooling"; internal const string TransactionBinding = "transaction binding"; - internal const string TrustServerCertificate = "trustservercertificate"; + internal const string TrustServerCertificate = "trust server certificate"; internal const string Type_System_Version = "type system version"; internal const string User_ID = "user id"; internal const string User_Instance = "user instance"; internal const string Workstation_Id = "workstation id"; internal const string Replication = "replication"; - internal const string Connect_Retry_Count = "connectretrycount"; - internal const string Connect_Retry_Interval = "connectretryinterval"; + internal const string Connect_Retry_Count = "connect retry count"; + internal const string Connect_Retry_Interval = "connect retry interval"; internal const string Authentication = "authentication"; } // Constant for the number of duplicate options in the connection string - private static class SYNONYM { + //application intent + internal const string APPLICATIONINTENT = "applicationintent"; // application name internal const string APP = "app"; internal const string Async = "async"; @@ -123,15 +124,29 @@ private static class SYNONYM internal const string DATABASE = "database"; // integrated security internal const string TRUSTED_CONNECTION = "trusted_connection"; + //connect retry count + internal const string CONNECTRETRYCOUNT = "connectretrycount"; + //connect retry interval + internal const string CONNECTRETRYINTERVAL = "connectretryinterval"; // load balance timeout internal const string Connection_Lifetime = "connection lifetime"; + // multiple active result sets + internal const string MULTIPLEACTIVERESULTSETS = "multipleactiveresultsets"; + // multi subnet failover + internal const string MULTISUBNETFAILOVER = "multisubnetfailover"; // network library internal const string NET = "net"; internal const string NETWORK = "network"; +#if netcoreapp + // pool blocking period + internal const string POOLBLOCKINGPERIOD = "poolblockingperiod"; +#endif // password internal const string Pwd = "pwd"; // persist security info internal const string PERSISTSECURITYINFO = "persistsecurityinfo"; + // trust server certificate + internal const string TRUSTSERVERCERTIFICATE = "trustservercertificate"; // user id internal const string UID = "uid"; internal const string User = "user"; @@ -140,10 +155,13 @@ private static class SYNONYM // make sure to update SynonymCount value below when adding or removing synonyms } - internal const int SynonymCount = 18; +#if netcoreapp + internal const int SynonymCount = 25; +#else + internal const int SynonymCount = 24; +#endif internal const int DeprecatedSynonymCount = 3; - internal enum TypeSystem { Latest = 2008, @@ -566,7 +584,7 @@ protected internal override string Expand() { if (null != _expandedAttachDBFilename) { - return ExpandAttachDbFileName(_expandedAttachDBFilename); + return ExpandAttachDbFileName(_expandedAttachDBFilename); } else { @@ -650,15 +668,23 @@ internal static Dictionary GetParseSynonyms() { KEY.Authentication, KEY.Authentication }, { SYNONYM.APP, KEY.Application_Name }, + { SYNONYM.APPLICATIONINTENT, KEY.ApplicationIntent }, { SYNONYM.Async, KEY.AsynchronousProcessing }, { SYNONYM.EXTENDED_PROPERTIES, KEY.AttachDBFilename }, { SYNONYM.INITIAL_FILE_NAME, KEY.AttachDBFilename }, + { SYNONYM.CONNECTRETRYCOUNT, KEY.Connect_Retry_Count }, + { SYNONYM.CONNECTRETRYINTERVAL, KEY.Connect_Retry_Interval }, { SYNONYM.CONNECTION_TIMEOUT, KEY.Connect_Timeout }, { SYNONYM.TIMEOUT, KEY.Connect_Timeout }, { SYNONYM.LANGUAGE, KEY.Current_Language }, { SYNONYM.ADDR, KEY.Data_Source }, { SYNONYM.ADDRESS, KEY.Data_Source }, + { SYNONYM.MULTIPLEACTIVERESULTSETS, KEY.MARS }, + { SYNONYM.MULTISUBNETFAILOVER, KEY.MultiSubnetFailover }, { SYNONYM.NETWORK_ADDRESS, KEY.Data_Source }, +#if netcoreapp + { SYNONYM.POOLBLOCKINGPERIOD, KEY.PoolBlockingPeriod}, +#endif { SYNONYM.SERVER, KEY.Data_Source }, { SYNONYM.DATABASE, KEY.Initial_Catalog }, { SYNONYM.TRUSTED_CONNECTION, KEY.Integrated_Security }, @@ -667,6 +693,7 @@ internal static Dictionary GetParseSynonyms() { SYNONYM.NETWORK, KEY.Network_Library }, { SYNONYM.Pwd, KEY.Password }, { SYNONYM.PERSISTSECURITYINFO, KEY.Persist_Security_Info }, + { SYNONYM.TRUSTSERVERCERTIFICATE, KEY.TrustServerCertificate }, { SYNONYM.UID, KEY.User_ID }, { SYNONYM.User, KEY.User_ID }, { SYNONYM.WSID, KEY.Workstation_Id } @@ -843,7 +870,7 @@ internal SqlConnectionAttestationProtocol ConvertValueToAttestationProtocol() } catch (FormatException e) { - throw ADP.InvalidConnectionOptionValue(KEY.AttestationProtocol, e); + throw ADP.InvalidConnectionOptionValue(KEY.AttestationProtocol, e); } catch (OverflowException e) { 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 be99f295ed..2353243a1a 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 @@ -201,17 +201,26 @@ private static Dictionary CreateKeywordsDictionary() hash.Add(DbConnectionStringKeywords.AttestationProtocol, Keywords.AttestationProtocol); hash.Add(DbConnectionStringSynonyms.APP, Keywords.ApplicationName); + hash.Add(DbConnectionStringSynonyms.APPLICATIONINTENT, Keywords.ApplicationIntent); hash.Add(DbConnectionStringSynonyms.EXTENDEDPROPERTIES, Keywords.AttachDBFilename); hash.Add(DbConnectionStringSynonyms.INITIALFILENAME, Keywords.AttachDBFilename); hash.Add(DbConnectionStringSynonyms.CONNECTIONTIMEOUT, Keywords.ConnectTimeout); + hash.Add(DbConnectionStringSynonyms.CONNECTRETRYCOUNT, Keywords.ConnectRetryCount); + hash.Add(DbConnectionStringSynonyms.CONNECTRETRYINTERVAL, Keywords.ConnectRetryInterval); hash.Add(DbConnectionStringSynonyms.TIMEOUT, Keywords.ConnectTimeout); hash.Add(DbConnectionStringSynonyms.LANGUAGE, Keywords.CurrentLanguage); hash.Add(DbConnectionStringSynonyms.ADDR, Keywords.DataSource); hash.Add(DbConnectionStringSynonyms.ADDRESS, Keywords.DataSource); + hash.Add(DbConnectionStringSynonyms.MULTIPLEACTIVERESULTSETS, Keywords.MultipleActiveResultSets); + hash.Add(DbConnectionStringSynonyms.MULTISUBNETFAILOVER, Keywords.MultiSubnetFailover); hash.Add(DbConnectionStringSynonyms.NETWORKADDRESS, Keywords.DataSource); +#if netcoreapp + hash.Add(DbConnectionStringSynonyms.POOLBLOCKINGPERIOD, Keywords.PoolBlockingPeriod); +#endif hash.Add(DbConnectionStringSynonyms.SERVER, Keywords.DataSource); hash.Add(DbConnectionStringSynonyms.DATABASE, Keywords.InitialCatalog); hash.Add(DbConnectionStringSynonyms.TRUSTEDCONNECTION, Keywords.IntegratedSecurity); + hash.Add(DbConnectionStringSynonyms.TRUSTSERVERCERTIFICATE, Keywords.TrustServerCertificate); hash.Add(DbConnectionStringSynonyms.ConnectionLifetime, Keywords.LoadBalanceTimeout); hash.Add(DbConnectionStringSynonyms.Pwd, Keywords.Password); hash.Add(DbConnectionStringSynonyms.PERSISTSECURITYINFO, Keywords.PersistSecurityInfo); diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs index 44cc4bb3e1..2caf38098f 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.cs @@ -822,7 +822,7 @@ public SqlConnectionStringBuilder() { } /// public SqlConnectionStringBuilder(string connectionString) { } /// - [System.ComponentModel.DisplayNameAttribute("ApplicationIntent")] + [System.ComponentModel.DisplayNameAttribute("Application Intent")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.ApplicationIntent ApplicationIntent { get { throw null; } set { } } /// @@ -853,11 +853,11 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ObsoleteAttribute("ConnectionReset has been deprecated. SqlConnection will ignore the 'connection reset' keyword and always reset the connection")] public bool ConnectionReset { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("ConnectRetryCount")] + [System.ComponentModel.DisplayNameAttribute("Connect Retry Count")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int ConnectRetryCount { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("ConnectRetryInterval")] + [System.ComponentModel.DisplayNameAttribute("Connect Retry Interval")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int ConnectRetryInterval { get { throw null; } set { } } /// @@ -924,11 +924,11 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public int MinPoolSize { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("MultipleActiveResultSets")] + [System.ComponentModel.DisplayNameAttribute("Multiple Active Result Sets")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool MultipleActiveResultSets { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("MultiSubnetFailover")] + [System.ComponentModel.DisplayNameAttribute("Multi Subnet Failover")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool MultiSubnetFailover { get { throw null; } set { } } /// @@ -949,7 +949,7 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool PersistSecurityInfo { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("PoolBlockingPeriod")] + [System.ComponentModel.DisplayNameAttribute("Pool Blocking Period")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public Microsoft.Data.SqlClient.PoolBlockingPeriod PoolBlockingPeriod { get { throw null; } set { } } /// @@ -965,11 +965,11 @@ public SqlConnectionStringBuilder(string connectionString) { } [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public string TransactionBinding { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("TransparentNetworkIPResolution")] + [System.ComponentModel.DisplayNameAttribute("Transparent Network IP Resolution")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool TransparentNetworkIPResolution { get { throw null; } set { } } /// - [System.ComponentModel.DisplayNameAttribute("TrustServerCertificate")] + [System.ComponentModel.DisplayNameAttribute("Trust Server Certificate")] [System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)] public bool TrustServerCertificate { get { throw null; } set { } } /// diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionStringCommon.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionStringCommon.cs index f2b0c65155..94e013ffb3 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionStringCommon.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/DbConnectionStringCommon.cs @@ -1069,7 +1069,7 @@ internal static class DbConnectionStringKeywords internal const string OmitOracleConnectionName = "Omit Oracle Connection Name"; // SqlClient - internal const string ApplicationIntent = "ApplicationIntent"; + internal const string ApplicationIntent = "Application Intent"; internal const string ApplicationName = "Application Name"; internal const string AsynchronousProcessing = "Asynchronous Processing"; internal const string AttachDBFilename = "AttachDbFilename"; @@ -1080,25 +1080,25 @@ internal static class DbConnectionStringKeywords internal const string Encrypt = "Encrypt"; internal const string FailoverPartner = "Failover Partner"; internal const string InitialCatalog = "Initial Catalog"; - internal const string MultipleActiveResultSets = "MultipleActiveResultSets"; - internal const string MultiSubnetFailover = "MultiSubnetFailover"; - internal const string TransparentNetworkIPResolution = "TransparentNetworkIPResolution"; + internal const string MultipleActiveResultSets = "Multiple Active Result Sets"; + internal const string MultiSubnetFailover = "Multi Subnet Failover"; + internal const string TransparentNetworkIPResolution = "Transparent Network IP Resolution"; internal const string NetworkLibrary = "Network Library"; internal const string PacketSize = "Packet Size"; internal const string Replication = "Replication"; internal const string TransactionBinding = "Transaction Binding"; - internal const string TrustServerCertificate = "TrustServerCertificate"; + internal const string TrustServerCertificate = "Trust Server Certificate"; internal const string TypeSystemVersion = "Type System Version"; internal const string UserInstance = "User Instance"; internal const string WorkstationID = "Workstation ID"; - internal const string ConnectRetryCount = "ConnectRetryCount"; - internal const string ConnectRetryInterval = "ConnectRetryInterval"; + internal const string ConnectRetryCount = "Connect Retry Count"; + internal const string ConnectRetryInterval = "Connect Retry Interval"; internal const string Authentication = "Authentication"; internal const string Certificate = "Certificate"; internal const string ColumnEncryptionSetting = "Column Encryption Setting"; internal const string EnclaveAttestationUrl = "Enclave Attestation Url"; internal const string AttestationProtocol = "Attestation Protocol"; - internal const string PoolBlockingPeriod = "PoolBlockingPeriod"; + internal const string PoolBlockingPeriod = "Pool Blocking Period"; // common keywords (OleDb, OracleClient, SqlClient) internal const string DataSource = "Data Source"; @@ -1123,6 +1123,9 @@ internal static class DbConnectionStringSynonyms //internal const string ApplicationName = APP; internal const string APP = "app"; + //internal const string ApplicationIntent = APPLICATIONINTENT; + internal const string APPLICATIONINTENT = "ApplicationIntent"; + //internal const string AttachDBFilename = EXTENDEDPROPERTIES+","+INITIALFILENAME; internal const string EXTENDEDPROPERTIES = "extended properties"; internal const string INITIALFILENAME = "initial file name"; @@ -1131,6 +1134,12 @@ internal static class DbConnectionStringSynonyms internal const string CONNECTIONTIMEOUT = "connection timeout"; internal const string TIMEOUT = "timeout"; + //internal const string ConnectRetryCount = CONNECTRETRYCOUNT; + internal const string CONNECTRETRYCOUNT = "ConnectRetryCount"; + + //internal const string ConnectRetryInterval = CONNECTRETRYINTERVAL; + internal const string CONNECTRETRYINTERVAL = "ConnectRetryInterval"; + //internal const string CurrentLanguage = LANGUAGE; internal const string LANGUAGE = "language"; @@ -1150,10 +1159,19 @@ internal static class DbConnectionStringSynonyms //internal const string LoadBalanceTimeout = ConnectionLifetime; internal const string ConnectionLifetime = "connection lifetime"; + //internal const string MultipleActiveResultSets = MULTIPLEACTIVERESULTSETS; + internal const string MULTIPLEACTIVERESULTSETS = "MultipleActiveResultSets"; + + //internal const string MultiSubnetFailover = MULTISUBNETFAILOVER; + internal const string MULTISUBNETFAILOVER = "MultiSubnetFailover"; + //internal const string NetworkLibrary = NET+","+NETWORK; internal const string NET = "net"; internal const string NETWORK = "network"; + //internal const string PoolBlockingPeriod = POOLBLOCKINGPERIOD; + internal const string POOLBLOCKINGPERIOD = "PoolBlockingPeriod"; + internal const string WorkaroundOracleBug914652 = "Workaround Oracle Bug 914652"; //internal const string Password = Pwd; @@ -1162,6 +1180,12 @@ internal static class DbConnectionStringSynonyms //internal const string PersistSecurityInfo = PERSISTSECURITYINFO; internal const string PERSISTSECURITYINFO = "persistsecurityinfo"; + //internal const string TrustServerCertificate = TRUSTSERVERCERTIFICATE; + internal const string TRUSTSERVERCERTIFICATE = "TrustServerCertificate"; + + //internal const string TransparentNetworkIPResolution = TRANSPARENTNETWORKIPRESOLUTION; + internal const string TRANSPARENTNETWORKIPRESOLUTION = "TransparentNetworkIPResolution"; + //internal const string UserID = UID+","+User; internal const string UID = "uid"; internal const string User = "user"; diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionString.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionString.cs index bf4b40b5ee..d5ee9b7724 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionString.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionString.cs @@ -65,11 +65,11 @@ internal static class DEFAULT // keys must be lowercase! internal static class KEY { - internal const string ApplicationIntent = "applicationintent"; + internal const string ApplicationIntent = "application intent"; internal const string Application_Name = "application name"; internal const string AsynchronousProcessing = "asynchronous processing"; internal const string AttachDBFilename = "attachdbfilename"; - internal const string PoolBlockingPeriod = "poolblockingperiod"; + internal const string PoolBlockingPeriod = "pool blocking period"; internal const string ColumnEncryptionSetting = "column encryption setting"; internal const string EnclaveAttestationUrl = "enclave attestation url"; internal const string AttestationProtocol = "attestation protocol"; @@ -84,25 +84,25 @@ internal static class KEY internal const string Initial_Catalog = "initial catalog"; internal const string Integrated_Security = "integrated security"; internal const string Load_Balance_Timeout = "load balance timeout"; - internal const string MARS = "multipleactiveresultsets"; + internal const string MARS = "multiple active result sets"; internal const string Max_Pool_Size = "max pool size"; internal const string Min_Pool_Size = "min pool size"; - internal const string MultiSubnetFailover = "multisubnetfailover"; - internal const string TransparentNetworkIPResolution = "transparentnetworkipresolution"; + internal const string MultiSubnetFailover = "multi subnet failover"; + internal const string TransparentNetworkIPResolution = "transparent network ip resolution"; internal const string Network_Library = "network library"; internal const string Packet_Size = "packet size"; internal const string Password = "password"; internal const string Persist_Security_Info = "persist security info"; internal const string Pooling = "pooling"; internal const string TransactionBinding = "transaction binding"; - internal const string TrustServerCertificate = "trustservercertificate"; + internal const string TrustServerCertificate = "trust server certificate"; internal const string Type_System_Version = "type system version"; internal const string User_ID = "user id"; internal const string User_Instance = "user instance"; internal const string Workstation_Id = "workstation id"; internal const string Replication = "replication"; - internal const string Connect_Retry_Count = "connectretrycount"; - internal const string Connect_Retry_Interval = "connectretryinterval"; + internal const string Connect_Retry_Count = "connect retry count"; + internal const string Connect_Retry_Interval = "connect retry interval"; internal const string Authentication = "authentication"; #if ADONET_CERT_AUTH internal const string Certificate = "certificate"; @@ -113,12 +113,18 @@ internal static class KEY private static class SYNONYM { + // application intent + internal const string APPLICATIONINTENT = "ApplicationIntent"; // application name internal const string APP = "app"; internal const string Async = "async"; // attachDBFilename internal const string EXTENDED_PROPERTIES = "extended properties"; internal const string INITIAL_FILE_NAME = "initial file name"; + // connect retry count + internal const string CONNECTRETRYCOUNT = "connectretrycount"; + // connect retry interval + internal const string CONNECTRETRYINTERVAL = "connectretryinterval"; // connect timeout internal const string CONNECTION_TIMEOUT = "connection timeout"; internal const string TIMEOUT = "timeout"; @@ -135,6 +141,10 @@ private static class SYNONYM internal const string TRUSTED_CONNECTION = "trusted_connection"; // load balance timeout internal const string Connection_Lifetime = "connection lifetime"; + // multiple active result sets + internal const string MULTIPLEACTIVERESULTSETS = "multipleactiveresultsets"; + // multi subnet failover + internal const string MULTISUBNETFAILOVER = "multisubnetfailover"; // network library internal const string NET = "net"; internal const string NETWORK = "network"; @@ -142,6 +152,12 @@ private static class SYNONYM internal const string Pwd = "pwd"; // persist security info internal const string PERSISTSECURITYINFO = "persistsecurityinfo"; + // pool blocking period + internal const string POOLBLOCKINGPERIOD = "poolblockingperiod"; + // transparent network ip resolution + internal const string TRANSPARENTNETWORKIPRESOLUTION = "transparentnetworkipresolution"; + // trust server certificate + internal const string TRUSTSERVERCERTIFICATE = "trustservercertificate"; // user id internal const string UID = "uid"; internal const string User = "user"; @@ -151,7 +167,7 @@ private static class SYNONYM // make sure to update SynonymCount value below when adding or removing synonyms } - internal const int SynonymCount = 21; + internal const int SynonymCount = 29; // the following are all inserted as keys into the _netlibMapping hash internal static class NETLIB @@ -779,15 +795,20 @@ internal static Hashtable GetParseSynonyms() #if ADONET_CERT_AUTH hash.Add(KEY.Certificate, KEY.Certificate); #endif + hash.Add(SYNONYM.APPLICATIONINTENT, KEY.ApplicationIntent); hash.Add(SYNONYM.APP, KEY.Application_Name); hash.Add(SYNONYM.Async, KEY.AsynchronousProcessing); hash.Add(SYNONYM.EXTENDED_PROPERTIES, KEY.AttachDBFilename); hash.Add(SYNONYM.INITIAL_FILE_NAME, KEY.AttachDBFilename); hash.Add(SYNONYM.CONNECTION_TIMEOUT, KEY.Connect_Timeout); + hash.Add(SYNONYM.CONNECTRETRYCOUNT, KEY.Connect_Retry_Count); + hash.Add(SYNONYM.CONNECTRETRYINTERVAL, KEY.Connect_Retry_Interval); hash.Add(SYNONYM.TIMEOUT, KEY.Connect_Timeout); hash.Add(SYNONYM.LANGUAGE, KEY.Current_Language); hash.Add(SYNONYM.ADDR, KEY.Data_Source); hash.Add(SYNONYM.ADDRESS, KEY.Data_Source); + hash.Add(SYNONYM.MULTIPLEACTIVERESULTSETS, KEY.MARS); + hash.Add(SYNONYM.MULTISUBNETFAILOVER, KEY.MultiSubnetFailover); hash.Add(SYNONYM.NETWORK_ADDRESS, KEY.Data_Source); hash.Add(SYNONYM.SERVER, KEY.Data_Source); hash.Add(SYNONYM.DATABASE, KEY.Initial_Catalog); @@ -796,7 +817,10 @@ internal static Hashtable GetParseSynonyms() hash.Add(SYNONYM.NET, KEY.Network_Library); hash.Add(SYNONYM.NETWORK, KEY.Network_Library); hash.Add(SYNONYM.Pwd, KEY.Password); + hash.Add(SYNONYM.POOLBLOCKINGPERIOD, KEY.PoolBlockingPeriod); hash.Add(SYNONYM.PERSISTSECURITYINFO, KEY.Persist_Security_Info); + hash.Add(SYNONYM.TRANSPARENTNETWORKIPRESOLUTION, KEY.TransparentNetworkIPResolution); + hash.Add(SYNONYM.TRUSTSERVERCERTIFICATE, KEY.TrustServerCertificate); hash.Add(SYNONYM.UID, KEY.User_ID); hash.Add(SYNONYM.User, KEY.User_ID); hash.Add(SYNONYM.WSID, KEY.Workstation_Id); diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs index b5d458d7a6..5cf2cfdb9a 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnectionStringBuilder.cs @@ -233,15 +233,21 @@ static SqlConnectionStringBuilder() hash.Add(DbConnectionStringKeywords.Certificate, Keywords.Certificate); #endif hash.Add(DbConnectionStringSynonyms.APP, Keywords.ApplicationName); + hash.Add(DbConnectionStringSynonyms.APPLICATIONINTENT, Keywords.ApplicationIntent); hash.Add(DbConnectionStringSynonyms.Async, Keywords.AsynchronousProcessing); hash.Add(DbConnectionStringSynonyms.EXTENDEDPROPERTIES, Keywords.AttachDBFilename); hash.Add(DbConnectionStringSynonyms.INITIALFILENAME, Keywords.AttachDBFilename); hash.Add(DbConnectionStringSynonyms.CONNECTIONTIMEOUT, Keywords.ConnectTimeout); + hash.Add(DbConnectionStringSynonyms.CONNECTRETRYCOUNT, Keywords.ConnectRetryCount); + hash.Add(DbConnectionStringSynonyms.CONNECTRETRYINTERVAL, Keywords.ConnectRetryInterval); hash.Add(DbConnectionStringSynonyms.TIMEOUT, Keywords.ConnectTimeout); hash.Add(DbConnectionStringSynonyms.LANGUAGE, Keywords.CurrentLanguage); hash.Add(DbConnectionStringSynonyms.ADDR, Keywords.DataSource); hash.Add(DbConnectionStringSynonyms.ADDRESS, Keywords.DataSource); + hash.Add(DbConnectionStringSynonyms.MULTIPLEACTIVERESULTSETS, Keywords.MultipleActiveResultSets); + hash.Add(DbConnectionStringSynonyms.MULTISUBNETFAILOVER, Keywords.MultiSubnetFailover); hash.Add(DbConnectionStringSynonyms.NETWORKADDRESS, Keywords.DataSource); + hash.Add(DbConnectionStringSynonyms.POOLBLOCKINGPERIOD, Keywords.PoolBlockingPeriod); hash.Add(DbConnectionStringSynonyms.SERVER, Keywords.DataSource); hash.Add(DbConnectionStringSynonyms.DATABASE, Keywords.InitialCatalog); hash.Add(DbConnectionStringSynonyms.TRUSTEDCONNECTION, Keywords.IntegratedSecurity); @@ -250,6 +256,8 @@ static SqlConnectionStringBuilder() hash.Add(DbConnectionStringSynonyms.NETWORK, Keywords.NetworkLibrary); hash.Add(DbConnectionStringSynonyms.Pwd, Keywords.Password); hash.Add(DbConnectionStringSynonyms.PERSISTSECURITYINFO, Keywords.PersistSecurityInfo); + hash.Add(DbConnectionStringSynonyms.TRANSPARENTNETWORKIPRESOLUTION, Keywords.TransparentNetworkIPResolution); + hash.Add(DbConnectionStringSynonyms.TRUSTSERVERCERTIFICATE, Keywords.TrustServerCertificate); hash.Add(DbConnectionStringSynonyms.UID, Keywords.UserID); hash.Add(DbConnectionStringSynonyms.User, Keywords.UserID); hash.Add(DbConnectionStringSynonyms.WSID, Keywords.WorkstationID); diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionStringBuilderTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionStringBuilderTest.cs index 553727b03a..71cdc325dd 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionStringBuilderTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionStringBuilderTest.cs @@ -11,30 +11,74 @@ public class SqlConnectionStringBuilderTest { [Theory] - [InlineData("Data Source= randomserver.sys.local")] - [InlineData("Data Source= randomserver.sys.local; uid = a; pwd = b")] - [InlineData("Workstation ID = myworkstation")] - [InlineData("WSID = myworkstation")] [InlineData("Application Name = .Net Tests")] + [InlineData("Application Intent = ReadOnly")] + [InlineData("ApplicationIntent = ReadOnly")] + [InlineData("Attestation Protocol = HGS")] + [InlineData("Authentication = Active Directory Password ")] + [InlineData("Authentication = ActiveDirectoryPassword ")] + [InlineData("ConnectRetryCount = 5")] + [InlineData("Connect Retry Count = 0")] + [InlineData("ConnectRetryInterval = 10")] + [InlineData("Connect Retry Interval = 20")] + [InlineData("Connect Timeout = 30")] + [InlineData("Connection Timeout = 5")] + [InlineData("Connection Lifetime = 30")] + [InlineData("Load Balance Timeout = 0")] + [InlineData("Current Language = true")] + [InlineData("Timeout = 0")] + [InlineData("Column Encryption Setting = Enabled")] + [InlineData("Data Source = randomserver.sys.local")] + [InlineData("Address = np:localhost")] + [InlineData("Network Address = (localdb)\\myInstance")] + [InlineData("Server = randomserver.sys.local; uid = a; pwd = b")] + [InlineData("Addr = randomserver.sys.local; User Id = a; Password = b")] + [InlineData("Database = master")] + [InlineData("Enclave Attestation Url = http://dymmyurl")] + [InlineData("Encrypt = true")] + [InlineData("Enlist = false")] + [InlineData("Failover Partner = randomserver.sys.local")] + [InlineData("Initial Catalog = Northwind")] + [InlineData("Integrated Security = true")] + [InlineData("Trusted_Connection = false")] + [InlineData("Max Pool Size = 50")] + [InlineData("Min Pool Size = 20")] + [InlineData("MultipleActiveResultSets = true")] + [InlineData("Multiple Active Result Sets = false")] + [InlineData("Multi Subnet Failover = true")] + [InlineData("Packet Size = 12000")] + [InlineData("Password = some@pass#!@123")] + [InlineData("Persist Security Info = false")] + [InlineData("PersistSecurityInfo = true")] + [InlineData("Pooling = no")] [InlineData("Pooling = false")] - public void ConnectionStringTests(string connectionString) - { - ExecuteConnectionStringTests(connectionString); - } - - [Theory] [InlineData("PoolBlockingPeriod = Auto")] [InlineData("PoolBlockingperiod = NeverBlock")] - public void ConnectionStringTestsNetCoreApp(string connectionString) + [InlineData("Replication = true")] + [InlineData("Transaction Binding = Explicit Unbind")] + [InlineData("Trust Server Certificate = true")] + [InlineData("TrustServerCertificate = false")] + [InlineData("Type System Version = Latest")] + [InlineData("User Instance = true")] + [InlineData("Workstation ID = myworkstation")] + [InlineData("WSID = myworkstation")] + public void ConnectionStringTests(string connectionString) { ExecuteConnectionStringTests(connectionString); } [Theory] - [InlineData("Authentication = Active Directory Password ")] + [InlineData("Asynchronous Processing = True")] [InlineData("Authentication = Active Directory Integrated ")] - [InlineData("Authentication = ActiveDirectoryPassword ")] [InlineData("Authentication = ActiveDirectoryIntegrated ")] + [InlineData("Authentication = Active Directory Interactive ")] + [InlineData("Authentication = ActiveDirectoryInteractive ")] + [InlineData("Context Connection = true")] + [InlineData("Network Library = dbmssocn")] + [InlineData("Network = dbnmpntw")] + [InlineData("Net = dbmsrpcn")] + [InlineData("TransparentNetworkIPResolution = false")] + [InlineData("Transparent Network IP Resolution = true")] [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework)] public void ConnectionStringTestsNetFx(string connectionString) { diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs index 05035da6ba..244e008f96 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs @@ -729,6 +729,23 @@ public void ConnectionString_Database_Synonyms() Assert.Equal("db", cn.Database); } + [Fact] + public void ConnectionString_MARS_Synonyms() + { + SqlConnection cn = null; + SqlConnectionStringBuilder builder = null; + + cn = new SqlConnection(); + cn.ConnectionString = "MultipleActiveResultSets=true"; + builder = new SqlConnectionStringBuilder(cn.ConnectionString); + Assert.True(true == builder.MultipleActiveResultSets); + + cn = new SqlConnection(); + cn.ConnectionString = "Multiple Active Result Sets=true"; + builder = new SqlConnectionStringBuilder(cn.ConnectionString); + Assert.True(true == builder.MultipleActiveResultSets); + } + [Fact] public void ConnectionString_DataSource_Synonyms() { @@ -947,11 +964,11 @@ public void ConnectionString_MultipleActiveResultSets_Invalid() } catch (ArgumentException ex) { - // Invalid value for key 'multipleactiveresultsets' + // Invalid value for key 'multiple active result sets' Assert.Equal(typeof(ArgumentException), ex.GetType()); Assert.Null(ex.InnerException); Assert.NotNull(ex.Message); - Assert.True(ex.Message.IndexOf("'multipleactiveresultsets'") != -1); + Assert.True(ex.Message.IndexOf("'multiple active result sets'") != -1); Assert.Null(ex.ParamName); } }