update TransactionalAttribute

This commit is contained in:
28810 2020-05-09 15:26:26 +08:00
parent 713ef26909
commit 7c112861c0
3 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,8 @@ namespace FreeSql
public class TransactionalAttribute : DynamicProxyAttribute, IActionFilter
{
public Propagation Propagation { get; set; } = Propagation.Requierd;
public IsolationLevel? IsolationLevel { get; set; }
public IsolationLevel IsolationLevel { get => _IsolationLevelPriv.Value; set => _IsolationLevelPriv = value; }
IsolationLevel? _IsolationLevelPriv;
[DynamicProxyFromServices]
UnitOfWorkManager _uowManager;
@ -31,7 +32,7 @@ namespace FreeSql
Task OnBefore(UnitOfWorkManager uowm)
{
_uow = uowm.Begin(this.Propagation, this.IsolationLevel);
_uow = uowm.Begin(this.Propagation, this._IsolationLevelPriv);
return Task.FromResult(false);
}
Task OnAfter(Exception ex)

View File

@ -93,7 +93,7 @@ var items = UserGroup.Where(a => a.Id > 10).ToList();
# 事务建议
由于 AsyncLocal 平台兼容不好,所以交给外部管理。
由于 AsyncLocal 平台兼容不好,所以交给外部管理事务
```csharp
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();

View File

@ -93,7 +93,7 @@ var items = UserGroup.Where(a => a.Id > 10).ToList();
# 事务建议
由于 AsyncLocal 平台兼容不好,所以交给外部管理。
由于 AsyncLocal 平台兼容不好,所以交给外部管理事务
```csharp
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();