private static IDbCommand CreateAndOpen( this IDbCmd source) { var cmd = source.CreateCommand(); cmd.Connection.EnsureOpen(); return(cmd); }
internal static async Task <DbCommand> CreateAndOpenAsync( this IDbCmd source) { var cmd = source.CreateCommand(); await cmd.Connection.EnsureOpenAsync(source.CancellationToken).ConfigureAwait(false); if (cmd is DbCommand dbCommand) { return(dbCommand); } else { throw new InvalidOperationException("Async operations require use of a DbCommand"); } }