Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zqlovejyc authored May 13, 2021
1 parent 5bd94cf commit a8ec5c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,19 @@ IRepository trans = null;
try
{
//开启事务
trans = _repository.BeginTransaction();
trans = await _repository.BeginTransactionAsync();

//数据库写操作
await _repository.InsertAsync(entity);

//提交事务
trans.Commit();
await trans.CommitAsync();
}
catch (Exception)
{
//回滚事务
trans?.Rollback();
if(trans != null)
await tran.RollbackAsync();
throw;
}

Expand Down

0 comments on commit a8ec5c5

Please sign in to comment.