RangeShardMap<TKey>.OpenConnectionForKey Method

Definition

Overloads

OpenConnectionForKey(TKey, String)

Opens a regular System.Data.SqlClient.SqlConnection to the shard to which the specified key value is mapped, with Validate.

OpenConnectionForKey(TKey, String, ConnectionOptions)

Opens a regular System.Data.SqlClient.SqlConnection to the shard to which the specified key value is mapped.

OpenConnectionForKey(TKey, String)

Opens a regular System.Data.SqlClient.SqlConnection to the shard to which the specified key value is mapped, with Validate.

public System.Data.SqlClient.SqlConnection OpenConnectionForKey (TKey key, string connectionString);
override this.OpenConnectionForKey : 'Key * string -> System.Data.SqlClient.SqlConnection
Public Function OpenConnectionForKey (key As TKey, connectionString As String) As SqlConnection

Parameters

key
TKey

Input key value.

connectionString
System.String

Connection string with credential information such as SQL Server credentials or Integrated Security settings. The hostname of the server and the database name for the shard are obtained from the lookup operation for key.

Returns

System.Data.SqlClient.SqlConnection

An opened SqlConnection.

Remarks

Note that the System.Data.SqlClient.SqlConnection object returned by this call is not protected against transient faults. Callers should follow best practices to protect the connection against transient faults in their application code, e.g., by using the transient fault handling functionality in the Enterprise Library from Microsoft Patterns and Practices team.

Applies to

OpenConnectionForKey(TKey, String, ConnectionOptions)

Opens a regular System.Data.SqlClient.SqlConnection to the shard to which the specified key value is mapped.

public System.Data.SqlClient.SqlConnection OpenConnectionForKey (TKey key, string connectionString, Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ConnectionOptions options);
override this.OpenConnectionForKey : 'Key * string * Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ConnectionOptions -> System.Data.SqlClient.SqlConnection
Public Function OpenConnectionForKey (key As TKey, connectionString As String, options As ConnectionOptions) As SqlConnection

Parameters

key
TKey

Input key value.

connectionString
System.String

Connection string with credential information such as SQL Server credentials or Integrated Security settings. The hostname of the server and the database name for the shard are obtained from the lookup operation for key.

options
ConnectionOptions

Options for validation operations to perform on opened connection.

Returns

System.Data.SqlClient.SqlConnection

An opened SqlConnection.

Remarks

Note that the System.Data.SqlClient.SqlConnection object returned by this call is not protected against transient faults. Callers should follow best practices to protect the connection against transient faults in their application code, e.g., by using the transient fault handling functionality in the Enterprise Library from Microsoft Patterns and Practices team.

Applies to