public void Query_WriteDB_Elect()
 {
     var entity = _sqlMapper.QuerySingle <T_Entity>(new RequestContext
     {
         Scope   = Scope,
         SqlId   = "GetEntity",
         ReadDb  = "WriteDB",
         Request = new { Id = 8 }
     });
 }
Ejemplo n.º 2
0
 public T Find(TKey key, string sqlId = "GetEntity")
 {
     return(sqlMapper.QuerySingle <T>(new RequestContext
     {
         Scope = Scope,
         SqlId = sqlId,
         Request = new { Id = key }
     }));
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 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;
     }
 }
Ejemplo n.º 5
0
 public T QuerySingle <T>(RequestContext context)
 {
     return(MapperInstance.QuerySingle <T>(context));
 }
Ejemplo n.º 6
0
 public T QuerySingle <T>(RequestContext context)
 {
     return(SqlMapper.QuerySingle <T>(context));
 }