/// <summary>
 /// Executes the query (using Dapper), returning the data typed as T.
 /// </summary>
 public static T QueryFirstOrDefault <T>(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QueryFirstOrDefault <T>(sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning multiple result sets, and access each in turn.
 /// </summary>
 public static Task <SqlMapper.GridReader> QueryMultipleAsync(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QueryMultipleAsync(sql: command.Sql, param: command.Parameters.DapperParameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the data typed as T.
 /// </summary>
 public static IEnumerable <T> Query <T>(this ICompleteCommand command, IDbTransaction transaction = null, bool buffered = true, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.Query <T>(sql: command.Sql, param: command.Parameters, transaction: transaction, buffered: buffered, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning an System.Data.IDataReader
 /// </summary>
 public static IDataReader ExecuteReader(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.ExecuteReader(sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the first cell returned, as object.
 /// </summary>
 public static Task <object> ExecuteScalarAsync(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.ExecuteScalarAsync(sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the data typed as type.
 /// </summary>
 public static Task <object> QuerySingleOrDefaultAsync(this ICompleteCommand command, Type type, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QuerySingleOrDefaultAsync(type: type, sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the data typed as dynamic objects.
 /// </summary>
 public static Task <dynamic> QuerySingleAsync(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QuerySingleAsync(sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the data typed as T.
 /// </summary>
 public static Task <IEnumerable <T> > QueryAsync <T>(this ICompleteCommand command, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QueryAsync <T>(sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
 /// <summary>
 /// Executes the query (using Dapper), returning the data typed as type.
 /// </summary>
 public static object QueryFirst(this ICompleteCommand command, Type type, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null)
 {
     return(command.Connection.QueryFirst(type: type, sql: command.Sql, param: command.Parameters, transaction: transaction, commandTimeout: commandTimeout, commandType: commandType));
 }
Example #10
0
 /// <summary>
 /// Builds the final SQL and Parameters, passes to Entity Framework, and get the result IQueryable{TEntity}
 /// which can be used as you like (ToList, Where, etc).
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="command"></param>
 /// <returns></returns>
 public static IQueryable <TEntity> AsQueryable <TEntity>(this ICompleteCommand <TEntity> command)
     where TEntity : class
 {
     return(command.DbSet.FromSqlRaw(sql: command.Sql, parameters: command.Parameters.Items));
 }