- 优化 DbContext/Repository Orm 属性进行 CURD 与自身事务相同【新突破】;#270

This commit is contained in:
28810
2020-04-10 19:54:43 +08:00
parent d97dc3383c
commit 52fbe5ed86
17 changed files with 3884 additions and 3849 deletions

View File

@ -134,7 +134,7 @@ namespace FreeSql.Internal.CommonProvider
public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInfo table, Dictionary<string, bool> changedDict)
{
if (data == null) return;
if (typeof(T1) == typeof(object) && data.GetType() != table.Type)
if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false)
throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。");
foreach (var col in table.Columns.Values)
{

View File

@ -351,7 +351,7 @@ namespace FreeSql.Internal.CommonProvider
{
if (orm.Aop.AuditValueHandler == null) return;
if (data == null) return;
if (typeof(T1) == typeof(object) && data.GetType() != table.Type)
if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false)
throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。");
foreach (var col in table.Columns.Values)
{