mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-07 17:00:52 +08:00
update
4
事务.md
4
事务.md
@@ -120,6 +120,8 @@ using (var uow = fsql.CreateUnitOfWork())
|
||||
uow.Orm.Insert(new Products()).ExecuteAffrows(); //正常
|
||||
fsql.Insert(new Products()).ExecuteAffrows(); //错误,没有传事务
|
||||
fsql.Insert(new Products()).WithTransaction(uow.GetOrBeginTransaction()).ExecuteAffrows(); //正常
|
||||
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +133,8 @@ using (var ctx = fsql.CreateDbContext())
|
||||
ctx.Orm.Insert(new Products()).ExecuteAffrows(); //正常
|
||||
fsql.Insert(new Products()).ExecuteAffrows(); //错误,没有传事务
|
||||
fsql.Insert(new Products()).WithTransaction(ctx.UnitOfWork.GetOrBeginTransaction()).ExecuteAffrows(); //正常
|
||||
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user