System.Data.Common.DbConnection.OpenAsync C# (CSharp) Method

OpenAsync() public method

public OpenAsync ( ) : Task
return Task
        public Task OpenAsync() => OpenAsync(CancellationToken.None);

Same methods

DbConnection::OpenAsync ( CancellationToken cancellationToken ) : Task

Usage Example

Exemplo n.º 1
0
 /// <summary>
 /// Asynchronously opens the given connection.
 /// </summary>
 /// <param name="shardConnection">The connection to Open</param>
 /// <param name="cancellationToken">The cancellation token to be passed down</param>
 /// <returns>The task handling the Open. A completed task if the conn is already Open</returns>
 internal static Task OpenShardConnectionAsync(DbConnection shardConnection, CancellationToken cancellationToken)
 {
     if (shardConnection.State != ConnectionState.Open)
     {
         return shardConnection.OpenAsync(cancellationToken);
     }
     else
     {
         return Task.FromResult<object>(null);
     }
 }