mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
update TransactionalAttribute
This commit is contained in:
parent
713ef26909
commit
7c112861c0
@ -15,7 +15,8 @@ namespace FreeSql
|
|||||||
public class TransactionalAttribute : DynamicProxyAttribute, IActionFilter
|
public class TransactionalAttribute : DynamicProxyAttribute, IActionFilter
|
||||||
{
|
{
|
||||||
public Propagation Propagation { get; set; } = Propagation.Requierd;
|
public Propagation Propagation { get; set; } = Propagation.Requierd;
|
||||||
public IsolationLevel? IsolationLevel { get; set; }
|
public IsolationLevel IsolationLevel { get => _IsolationLevelPriv.Value; set => _IsolationLevelPriv = value; }
|
||||||
|
IsolationLevel? _IsolationLevelPriv;
|
||||||
|
|
||||||
[DynamicProxyFromServices]
|
[DynamicProxyFromServices]
|
||||||
UnitOfWorkManager _uowManager;
|
UnitOfWorkManager _uowManager;
|
||||||
@ -31,7 +32,7 @@ namespace FreeSql
|
|||||||
|
|
||||||
Task OnBefore(UnitOfWorkManager uowm)
|
Task OnBefore(UnitOfWorkManager uowm)
|
||||||
{
|
{
|
||||||
_uow = uowm.Begin(this.Propagation, this.IsolationLevel);
|
_uow = uowm.Begin(this.Propagation, this._IsolationLevelPriv);
|
||||||
return Task.FromResult(false);
|
return Task.FromResult(false);
|
||||||
}
|
}
|
||||||
Task OnAfter(Exception ex)
|
Task OnAfter(Exception ex)
|
||||||
|
@ -93,7 +93,7 @@ var items = UserGroup.Where(a => a.Id > 10).ToList();
|
|||||||
|
|
||||||
# 事务建议
|
# 事务建议
|
||||||
|
|
||||||
由于 AsyncLocal 平台兼容不好,所以交给外部管理。
|
由于 AsyncLocal 平台兼容不好,所以交给外部管理事务。
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();
|
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();
|
||||||
|
@ -93,7 +93,7 @@ var items = UserGroup.Where(a => a.Id > 10).ToList();
|
|||||||
|
|
||||||
# 事务建议
|
# 事务建议
|
||||||
|
|
||||||
由于 AsyncLocal 平台兼容不好,所以交给外部管理。
|
由于 AsyncLocal 平台兼容不好,所以交给外部管理事务。
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();
|
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user