public virtual IUnitOfWorkTransaction BeginTransaction() { var transaction = new UnitOfWorkTransaction(DbContext.Database.BeginTransaction()) { ActionsBeforeCommit = ActionsBeforeCommit, ActionsAfterCommit = ActionsAfterCommit, ActionsBeforeRollback = ActionsBeforeRollback, ActionsAfterRollback = ActionsAfterRollback }; return(transaction); }
public virtual async Task <IUnitOfWorkTransaction> BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken = default) { var transaction = new UnitOfWorkTransaction(await DbContext.Database .BeginTransactionAsync(isolationLevel, cancellationToken).ConfigureAwait(true)) { ActionsBeforeCommit = ActionsBeforeCommit, ActionsAfterCommit = ActionsAfterCommit, ActionsBeforeRollback = ActionsBeforeRollback, ActionsAfterRollback = ActionsAfterRollback }; return(transaction); }