diff --git a/事务.md b/事务.md index 8f4f952..b0ac917 100644 --- a/事务.md +++ b/事务.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(); }