RangeShardMap.OpenConnectionForKey Method (TKey, String)

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

Namespace: Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
Assembly: Microsoft.Azure.SqlDatabase.ElasticScale.Client (in Microsoft.Azure.SqlDatabase.ElasticScale.Client.dll)

Usage

'Usage
Dim instance As RangeShardMap(Of TKey)
Dim key As TKey
Dim connectionString As String
Dim returnValue As SqlConnection

returnValue = instance.OpenConnectionForKey(key, connectionString)

Syntax

'Declaration
<SuppressMessageAttribute("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods")> _
Public Function OpenConnectionForKey ( _
    key As TKey, _
    connectionString As String _
) As SqlConnection
[SuppressMessageAttribute("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods")] 
public SqlConnection OpenConnectionForKey (
    TKey key,
    string connectionString
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1061:DoNotHideBaseClassMethods")] 
public:
SqlConnection^ OpenConnectionForKey (
    TKey key, 
    String^ connectionString
)
/** @attribute SuppressMessageAttribute("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods") */ 
public SqlConnection OpenConnectionForKey (
    TKey key, 
    String connectionString
)
SuppressMessageAttribute("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods") 
public function OpenConnectionForKey (
    key : TKey, 
    connectionString : String
) : SqlConnection

Parameters

  • key
    Input key value.
  • connectionString
    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.

Return Value

An opened SqlConnection.

Remarks

Note that the 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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

See Also

Reference

RangeShardMap Class
RangeShardMap Members
Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement Namespace