public void Query_WriteDB_Elect() { var entity = _sqlMapper.QuerySingle <T_Entity>(new RequestContext { Scope = Scope, SqlId = "GetEntity", ReadDb = "WriteDB", Request = new { Id = 8 } }); }
public T Find(TKey key, string sqlId = "GetEntity") { return(sqlMapper.QuerySingle <T>(new RequestContext { Scope = Scope, SqlId = sqlId, Request = new { Id = key } })); }
public static T QuerySingle <T>(this ISmartSqlMapper sqlMapper, string fullSqlId, dynamic @params, DataSourceChoice sourceChoice) { EnsurePoint(ref fullSqlId); return(sqlMapper.QuerySingle <T>(new RequestContext() { Scope = fullSqlId.Split('.')[0], SqlId = fullSqlId.Split('.')[1], Request = @params }, sourceChoice)); }
public void BeginTransaction() { try { _sqlMapper.BeginTransaction(); var entity = _sqlMapper.QuerySingle <T_Entity>(new RequestContext { Scope = Scope, SqlId = "GetEntity", Request = new { Id = 8 } }); Insert(); Insert(); Insert(); _sqlMapper.CommitTransaction(); } catch (Exception ex) { _sqlMapper.RollbackTransaction(); throw ex; } }
public T QuerySingle <T>(RequestContext context) { return(MapperInstance.QuerySingle <T>(context)); }
public T QuerySingle <T>(RequestContext context) { return(SqlMapper.QuerySingle <T>(context)); }