internal async Task InitCommandAsync(CommandType commandType, string sql, DataParameter[] parameters, CancellationToken cancellationToken) { if (_connection == null) _connection = DataProvider.CreateConnection(ConnectionString); if (_connection.State == ConnectionState.Closed) { await ((DbConnection)_connection).OpenAsync(cancellationToken); _closeConnection = true; } InitCommand(commandType, sql, parameters, null); }
public static IEnumerable <T> Query <T>(this DataConnection connection, string sql, DataParameter parameter) { return(new CommandInfo(connection, sql, parameter).Query <T>()); }
public static CommandInfo SetCommand(DataConnection dataConnection, string commandText, DataParameter parameter) { return(new CommandInfo(dataConnection, commandText, parameter)); }
public static DataReader ExecuteReader(this DataConnection connection, string sql, DataParameter parameter) { return(new CommandInfo(connection, sql, parameter).ExecuteReader()); }
public static T Execute <T>(this DataConnection connection, string sql, DataParameter parameter) { return(new CommandInfo(connection, sql, parameter).Execute <T>()); }
public static DataReader ExecuteReader(this DataConnection connection, string sql, DataParameter parameter) { return(ExecuteReader(connection, sql, new[] { parameter })); }
public static IEnumerable <T> Query <T>(this DataConnection connection, string sql, DataParameter parameter) { return(Query <T>(connection, sql, new[] { parameter })); }
public CommandInfo(DataConnection dataConnection, string commandText, DataParameter parameter) { DataConnection = dataConnection; CommandText = commandText; Parameters = new[] { parameter }; }
internal void InitCommand(CommandType commandType, string sql, DataParameter[] parameters, List<string> queryHints) { if (queryHints != null && queryHints.Count > 0) { var sqlProvider = DataProvider.CreateSqlBuilder(); sql = sqlProvider.ApplyQueryHints(sql, queryHints); queryHints.Clear(); } DataProvider.InitCommand(this, commandType, sql, parameters); LastQuery = Command.CommandText; }