コード例 #1
0
		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);
		}
コード例 #2
0
 public static IEnumerable <T> Query <T>(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).Query <T>());
 }
コード例 #3
0
 public static CommandInfo SetCommand(DataConnection dataConnection, string commandText, DataParameter parameter)
 {
     return(new CommandInfo(dataConnection, commandText, parameter));
 }
コード例 #4
0
 public static DataReader ExecuteReader(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).ExecuteReader());
 }
コード例 #5
0
 public static T Execute <T>(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).Execute <T>());
 }
コード例 #6
0
 public static DataReader ExecuteReader(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(ExecuteReader(connection, sql, new[] { parameter }));
 }
コード例 #7
0
 public static IEnumerable <T> Query <T>(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(Query <T>(connection, sql, new[] { parameter }));
 }
コード例 #8
0
 public CommandInfo(DataConnection dataConnection, string commandText, DataParameter parameter)
 {
     DataConnection = dataConnection;
     CommandText    = commandText;
     Parameters     = new[] { parameter };
 }
コード例 #9
0
ファイル: DataConnection.cs プロジェクト: r0t0r-r0t0r/linq2db
        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;
        }