Ejemplo n.º 1
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.º 2
0
 public static void TransactionWrap(this ISmartSqlMapper sqlMapper, IsolationLevel isolationLevel, Action handler)
 {
     try
     {
         sqlMapper.BeginTransaction(isolationLevel);
         handler();
         sqlMapper.CommitTransaction();
     }
     catch (Exception ex)
     {
         sqlMapper.RollbackTransaction();
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public void UseTransaction()
 {
     try
     {
         _smartSqlMapper.BeginTransaction();
         //Biz();
         _smartSqlMapper.CommitTransaction();
     }
     catch (Exception ex)
     {
         _smartSqlMapper.RollbackTransaction();
         throw ex;
     }
 }
Ejemplo n.º 4
0
        public async static Task TransactionWrapAsync(this ISmartSqlMapper sqlMapper, IsolationLevel isolationLevel, Func <Task> handler)
        {
            try
            {
                sqlMapper.BeginTransaction(isolationLevel);
                await handler().ConfigureAwait(false);

                sqlMapper.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMapper.RollbackTransaction();
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public async static Task TransactionWrapAsync(this ISmartSqlMapper sqlMapper, Func <Task> handler)
        {
            try
            {
                sqlMapper.BeginTransaction();
                await handler();

                sqlMapper.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMapper.RollbackTransaction();
                throw ex;
            }
        }
Ejemplo n.º 6
0
 public void CommitTransaction()
 {
     MapperInstance.CommitTransaction();
 }
Ejemplo n.º 7
0
 public void CommitTransaction()
 {
     SqlMapper.CommitTransaction();
 }