<PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0-preview4.26064.3" />

Microsoft.Data.SqlClient.SqlConnectionStringBuilder

Provides a simple way to create and manage the contents of connection strings used by the SqlConnection class.
public ApplicationIntent ApplicationIntent { get; set; }

Declares the application workload type when connecting to a database in an SQL Server Availability Group. You can set the value of this property with ApplicationIntent. For more information about SqlClient support for Always On Availability Groups, see SqlClient Support for High Availability, Disaster Recovery.

public string ApplicationName { get; set; }

Gets or sets the name of the application associated with the connection string.

public string AttachDBFilename { get; set; }

Gets or sets a string that contains the name of the primary data file. This includes the full path name of an attachable database.

Gets or sets the value of Attestation Protocol.

public SqlAuthenticationMethod Authentication { get; set; }

Gets or sets the authentication method used for Connect with Microsoft Entra to Azure SQL resources.

Gets or sets the column encryption settings for the connection string builder.

public int CommandTimeout { get; set; }

The default wait time (in seconds) before terminating the attempt to execute a command and generating an error. The default is 30 seconds.

public int ConnectRetryCount { get; set; }

The number of reconnections attempted after identifying that there was an idle connection failure. This must be an integer between 0 and 255. The default value for non Azure endpoints is 1. For Azure SQL endpoints, the default is 2. Starting in version 5.x, for Azure SQL serverless or on demand endpoints, the default is 5 to improve connection success for connections to an idle or paused instance. Set to 0 to disable reconnecting on idle connection failures. An ArgumentException will be thrown if set to a value outside the allowed range.

public int ConnectRetryInterval { get; set; }

Amount of time (in seconds) between each reconnection attempt after identifying that there was an idle connection failure. This must be an integer between 1 and 60. The default is 10 seconds.

public int ConnectTimeout { get; set; }

Gets or sets the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

public string CurrentLanguage { get; set; }

Gets or sets the language used for database server warning or error messages..

public string DataSource { get; set; }

Gets or sets the name or network address of the instance of SQL Server to connect to.

public string EnclaveAttestationUrl { get; set; }

Gets or sets the enclave attestation URL to be used with enclave based Always Encrypted.

public SqlConnectionEncryptOption Encrypt { get; set; }

Gets or sets a SqlConnectionEncryptOption value since version 5.0 or a Boolean value for the earlier versions that indicates whether TLS encryption is required for all data sent between the client and server.

public bool Enlist { get; set; }

Gets or sets a Boolean value that indicates whether the SQL Server connection pool automatically enlists the connection in the creation thread's current transaction context.

public string FailoverPartner { get; set; }

Gets or sets the name or address of the partner server to connect to if the primary server is down.

public string FailoverPartnerSPN { get; set; }

Gets or sets the service principal name (SPN) of the failover partner for the connection.

public string HostNameInCertificate { get; set; }

Gets or sets the host name to use when validating the server certificate for the connection. When not specified, the server name from the Data Source is used for certificate validation. (Only available in v5.0+)

public string InitialCatalog { get; set; }

Gets or sets the name of the database associated with the connection.

public bool IntegratedSecurity { get; set; }

Gets or sets a Boolean value that indicates whether User ID and Password are specified in the connection (when false ) or whether the current Windows account credentials are used for authentication (when true ).

Gets or sets the IP address family preference when establishing TCP connections.

public int LoadBalanceTimeout { get; set; }

Gets or sets the minimum time, in seconds, for the connection to live in the connection pool before being destroyed.

public int MaxPoolSize { get; set; }

Gets or sets the maximum number of connections allowed in the connection pool for this specific connection string.

public int MinPoolSize { get; set; }

Gets or sets the minimum number of connections allowed in the connection pool for this specific connection string.

public bool MultipleActiveResultSets { get; set; }

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. For more information, see Multiple Active Result Sets (MARS).

public bool MultiSubnetFailover { get; set; }

If your application is connecting to an AlwaysOn availability group (AG) on different subnets, setting MultiSubnetFailover=true provides faster detection of and connection to the (currently) active server. For more information about SqlClient support for Always On Availability Groups, see SqlClient Support for High Availability, Disaster Recovery.

public int PacketSize { get; set; }

Gets or sets the size in bytes of the network packets used to communicate with an instance of SQL Server.

public string Password { get; set; }

Gets or sets the password for the SQL Server account.

public bool PersistSecurityInfo { get; set; }

Gets or sets a Boolean value indicating if security-sensitive information, such as the password or access token, should be returned as part of the connection string on a connection created with this SqlConnectionStringBuilder after that connection has ever been in an open state. This property should only be set to true if your application has a specific need to read the password out of an already-opened database connection. The default value of false is the more secure setting; using true for this property opens your application to security risks such as accidentally logging or tracing the database password.

The blocking period behavior for a connection pool.

public bool Pooling { get; set; }

Gets or sets a Boolean value that indicates whether the connection will be pooled or explicitly opened every time that the connection is requested.

public bool Replication { get; set; }

Gets or sets a Boolean value that indicates whether replication is supported using the connection.

public string ServerCertificate { get; set; }

Gets or sets the path to a certificate file to match against the SQL Server TLS/SSL certificate for the connection. The accepted certificate formats are PEM, DER, and CER. If specified, the SQL Server certificate is checked by verifying if the `ServerCertificate` provided is an exact match. (Only available in v5.1+)

public string ServerSPN { get; set; }

Gets or sets the service principal name (SPN) of the data source.

public string TransactionBinding { get; set; }

Gets or sets a string value that indicates how the connection maintains its association with an enlisted System.Transactions transaction.

public bool TrustServerCertificate { get; set; }

Gets or sets a value that indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.

public string TypeSystemVersion { get; set; }

Gets or sets a string value that indicates the type system the application expects.

public string UserID { get; set; }

Gets or sets the user ID to be used when connecting to SQL Server.

public bool UserInstance { get; set; }

Gets or sets 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.

public string WorkstationID { get; set; }

Gets or sets the name of the workstation connecting to SQL Server.

Initializes a new instance of the SqlConnectionStringBuilder class.

public SqlConnectionStringBuilder(string connectionString)

Initializes a new instance of the SqlConnectionStringBuilder class. The provided connection string provides the data for the instance's internal connection information.