public async Task QuerySingleAsync() { RequestContext context = new RequestContext { Scope = Scope, SqlId = "GetEntity", Request = new { Id = 2 } }; var user = await _sqlMapper.QuerySingleAsync <T_Entity>(context); }
public static Task <T> QuerySingleAsync <T>(this ISmartSqlMapper sqlMapper, string fullSqlId, dynamic @params, DataSourceChoice sourceChoice) { EnsurePoint(ref fullSqlId); return(sqlMapper.QuerySingleAsync <T>(new RequestContext() { Scope = fullSqlId.Split('.')[0], SqlId = fullSqlId.Split('.')[1], Request = @params }, sourceChoice)); }
public async Task TransactionAsync() { try { _sqlMapper.BeginTransaction(); var entity = await _sqlMapper.QuerySingleAsync <T_Entity>(new RequestContext { Scope = Scope, SqlId = "GetEntity", Request = new { Id = 8 } }); await InsertAsync(); await InsertAsync(); await InsertAsync(); _sqlMapper.CommitTransaction(); } catch (Exception ex) { _sqlMapper.RollbackTransaction(); throw ex; } }
public Task <T> QuerySingleAsync <T>(RequestContext context) { return(MapperInstance.QuerySingleAsync <T>(context)); }
public Task <T> QuerySingleAsync <T>(RequestContext context) { return(SqlMapper.QuerySingleAsync <T>(context)); }