public static async Task ExecuteAsync( this SdmapContext ctx, ISession session, string statementId, object parameters = null) { var statement = ctx.Emit(statementId, parameters); var cursor = await session.RunAsync(statement, parameters.ToDictionary()); }
public static Task <object> ExecuteScalarAsync(this SdmapContext ctx, IDbConnection cnn, string statementId, object parameters = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.ExecuteScalarAsync(statement, parameters, transaction, commandTimeout, commandType)); }
public static Task <T> QuerySingleOrDefaultAsync <T>(this SdmapContext ctx, IDbConnection cnn, string statementId, object parameters = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.QuerySingleOrDefaultAsync <T>(statement, parameters, transaction, commandTimeout, commandType)); }
// asyncs public static Task <IEnumerable <dynamic> > QueryAsync(this SdmapContext ctx, IDbConnection cnn, string statementId, object parameters = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.QueryAsync(statement, parameters, transaction, commandTimeout, commandType)); }
public static SqlMapper.GridReader QueryMultiple(this SdmapContext ctx, IDbConnection cnn, string statementId, object parameters = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.QueryMultiple(statement, parameters, transaction, commandTimeout, commandType)); }
public static IEnumerable <T> Query <T>(this SdmapContext ctx, IDbConnection cnn, string statementId, object parameters = null, IDbTransaction transaction = null, bool buffered = true, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.Query <T>(statement, parameters, transaction, buffered, commandTimeout, commandType)); }
public static object QueryFirstOrDefault(this SdmapContext ctx, IDbConnection cnn, Type type, string statementId, object parameters = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.QueryFirstOrDefault(type, statement, parameters, transaction, commandTimeout, commandType)); }
public static async Task <T> ExecuteScalarAsync <T>( this SdmapContext ctx, ISession session, string statementId, object parameters = null) { var statement = ctx.Emit(statementId, parameters); var cursor = await session.RunAsync(statement, parameters.ToDictionary()); var fected = await cursor.FetchAsync(); return(fected ? cursor.Current[0].As <T>() : default);
public static IEnumerable <TReturn> Query <TFirst, TSecond, TReturn>( this SdmapContext ctx, IDbConnection cnn, string statementId, Func <TFirst, TSecond, TReturn> map, object parameters = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int?commandTimeout = null, CommandType?commandType = null) { var statement = ctx.Emit(statementId, parameters); return(cnn.Query(statement, map, parameters, transaction, buffered, splitOn, commandTimeout, commandType)); }
public static async Task <List <T> > QueryListAsync <T>( this SdmapContext ctx, ISession session, string statementId, object parameters = null) { var statement = ctx.Emit(statementId, parameters); var cursor = await session.RunAsync(statement, parameters.ToDictionary()); var result = new List <T>(); while (await cursor.FetchAsync()) { IRecord record = cursor.Current; result.Add(record.MapTo <T>()); } return(result); }