public IActionResult Transaction() { ISmartSqlMapper mapper = MapperContainer.Instance.GetSqlMapper(); mapper.BeginTransaction(); mapper.RollbackTransaction(); return(Json(new { Ok = true })); }
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 static void TransactionWrap(this ISmartSqlMapper sqlMapper, IsolationLevel isolationLevel, Action handler) { try { sqlMapper.BeginTransaction(isolationLevel); handler(); sqlMapper.CommitTransaction(); } catch (Exception ex) { sqlMapper.RollbackTransaction(); throw ex; } }
public void UseTransaction() { try { _smartSqlMapper.BeginTransaction(); //Biz(); _smartSqlMapper.CommitTransaction(); } catch (Exception ex) { _smartSqlMapper.RollbackTransaction(); throw ex; } }
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; } }
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; } }
public IDbConnectionSession BeginTransaction() { return(MapperInstance.BeginTransaction()); }
public IDbConnectionSession BeginTransaction() { return(SqlMapper.BeginTransaction()); }