update

28810
2020-04-24 22:40:49 +08:00
parent 459489733b
commit 17d62057cd
3 changed files with 8 additions and 7 deletions

@@ -12,7 +12,7 @@ using (var uow = fsql.CreateUnitOfWork()) {
}
```
.NetCore 无须像上面的硬编码方式[在 asp.net core 中使用 TransactionalAttribute + UnitOfWorkManager 实现多种事务传播](https://github.com/dotnetcore/FreeSql/issues/289)
参考[在 asp.net core 中使用 TransactionalAttribute + UnitOfWorkManager 实现多种事务传播](https://github.com/dotnetcore/FreeSql/issues/289)
## 2、DbContext

@@ -15,16 +15,17 @@ static IFreeSql fsql = new FreeSql.FreeSqlBuilder()
```csharp
using (var uow = fsql.CreateUnitOfWork()) {
var songRepo = uow.GetRepository<Song>();
var userRepo = uow.GetRepository<User>();
var songRepo = fsql.GetRepository<Song>() { UnitOfWork = uow };
var userRepo = fsql.GetRepository<User>() { UnitOfWork = uow };
//这里不受异步方法影响
songRepo.Insert(new Song());
userRepo.Update(...);
uow.Commit();
uow.Commit();
}
```
参考:[在 asp.net core 中使用 UnitOfWorkManager 实现多种事务传播](https://github.com/dotnetcore/FreeSql/issues/289)
参考:[在 asp.net core 中使用 TransactionalAttribute + UnitOfWorkManager 实现多种事务传播](https://github.com/dotnetcore/FreeSql/issues/289)
## 接口定义

@@ -24,7 +24,7 @@ fsql.Aop.CurdAfter += (s, e) =>
---
### 3、在 asp.net core 中使用 UnitOfWorkManager 实现多种事务传播
### 3、在 asp.net core 中使用 TransactionalAttribute + UnitOfWorkManager 实现多种事务传播
[https://github.com/dotnetcore/FreeSql/issues/289](https://github.com/dotnetcore/FreeSql/issues/289)