From 4acbc712d69bb15df2aefb95dbd35008a4ac1779 Mon Sep 17 00:00:00 2001
From: 28810 <28810@YEXIANGQIN>
Date: Mon, 17 Aug 2020 07:02:32 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E6=AD=A3=20UnitOfWorkManager=20Re?=
=?UTF-8?q?quierd=20=E5=91=BD=E5=90=8D=E4=B8=BA=20Required=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TransactionalAttribute.cs | 2 +-
.../UnitOfWork/UnitOfWorkManager.cs | 16 ++++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/Examples/aspnetcore_transaction/TransactionalAttribute.cs b/Examples/aspnetcore_transaction/TransactionalAttribute.cs
index 71f8cbc4..2dd58ad2 100644
--- a/Examples/aspnetcore_transaction/TransactionalAttribute.cs
+++ b/Examples/aspnetcore_transaction/TransactionalAttribute.cs
@@ -14,7 +14,7 @@ namespace FreeSql
[AttributeUsage(AttributeTargets.Method)]
public class TransactionalAttribute : DynamicProxyAttribute, IActionFilter
{
- public Propagation Propagation { get; set; } = Propagation.Requierd;
+ public Propagation Propagation { get; set; } = Propagation.Required;
public IsolationLevel IsolationLevel { get => _IsolationLevelPriv.Value; set => _IsolationLevelPriv = value; }
IsolationLevel? _IsolationLevelPriv;
diff --git a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs
index 2cf087b3..e4ae8931 100644
--- a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs
+++ b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs
@@ -85,11 +85,12 @@ namespace FreeSql
/// 事务传播方式
/// 事务隔离级别
///
- public IUnitOfWork Begin(Propagation propagation = Propagation.Requierd, IsolationLevel? isolationLevel = null)
+ public IUnitOfWork Begin(Propagation propagation = Propagation.Required, IsolationLevel? isolationLevel = null)
{
+ if (propagation == Propagation.Requierd) propagation = Propagation.Required;
switch (propagation)
{
- case Propagation.Requierd: return FindedUowCreateVirtual() ?? CreateUow(isolationLevel);
+ case Propagation.Required: return FindedUowCreateVirtual() ?? CreateUow(isolationLevel);
case Propagation.Supports: return FindedUowCreateVirtual() ?? CreateUowNothing(_allUows.LastOrDefault()?.IsNotSupported ?? false);
case Propagation.Mandatory: return FindedUowCreateVirtual() ?? throw new Exception("Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常");
case Propagation.NotSupported: return CreateUowNothing(true);
@@ -252,7 +253,7 @@ namespace FreeSql
///
/// 如果当前没有事务,就新建一个事务,如果已存在一个事务中,加入到这个事务中,默认的选择。
///
- Requierd,
+ Required,
///
/// 支持当前事务,如果没有当前事务,就以非事务方法执行。
///
@@ -272,6 +273,13 @@ namespace FreeSql
///
/// 以嵌套事务方式执行。
///
- Nested
+ Nested,
+
+
+ ///
+ /// 错误的命名,请使用 Required,在 2.0.0 删除
+ ///
+ [Obsolete("错误的命名,请使用 Required,在 2.0.0 删除")]
+ Requierd = 404
}
}