Exemplo n.º 1
0
        public virtual IUnitOfWorkTransaction BeginTransaction()
        {
            var transaction = new UnitOfWorkTransaction(DbContext.Database.BeginTransaction())
            {
                ActionsBeforeCommit   = ActionsBeforeCommit,
                ActionsAfterCommit    = ActionsAfterCommit,
                ActionsBeforeRollback = ActionsBeforeRollback,
                ActionsAfterRollback  = ActionsAfterRollback
            };

            return(transaction);
        }
Exemplo n.º 2
0
        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);
        }