From ef371af480f3244968eb33e22cca9f95704caf6e Mon Sep 17 00:00:00 2001
From: 2881099 <2881099@qq.com>
Date: Sun, 18 Sep 2022 17:56:55 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20Aop.ConfigEntity=20?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8=20ModifyResult=20=E8=AE=BF=E9=97=AE=E6=9C=80?=
=?UTF-8?q?=E6=96=B0=E7=9A=84=E8=AE=BE=E7=BD=AE=EF=BC=9B#1247?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql/Interface/IAop.cs | 4 ++--
FreeSql/Internal/CommonUtils.cs | 37 +++++++++++++++++++++++++++++++--
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/FreeSql/Interface/IAop.cs b/FreeSql/Interface/IAop.cs
index 17a189c4..612cdfaf 100644
--- a/FreeSql/Interface/IAop.cs
+++ b/FreeSql/Interface/IAop.cs
@@ -134,7 +134,7 @@ namespace FreeSql.Aop
///
/// 实体配置
///
- public TableAttribute ModifyResult { get; }
+ public TableAttribute ModifyResult { get; internal set; }
///
/// 索引配置
///
@@ -160,7 +160,7 @@ namespace FreeSql.Aop
///
/// 实体的属性配置
///
- public ColumnAttribute ModifyResult { get; }
+ public ColumnAttribute ModifyResult { get; internal set; }
}
#endregion
diff --git a/FreeSql/Internal/CommonUtils.cs b/FreeSql/Internal/CommonUtils.cs
index a79abd7e..d183b3ea 100644
--- a/FreeSql/Internal/CommonUtils.cs
+++ b/FreeSql/Internal/CommonUtils.cs
@@ -123,7 +123,16 @@ namespace FreeSql.Internal
case MappingPriorityType.Aop:
if (_orm.Aop.ConfigEntityHandler != null)
{
- var aope = new Aop.ConfigEntityEventArgs(type);
+ var aope = new Aop.ConfigEntityEventArgs(type)
+ {
+ ModifyResult = new TableAttribute
+ {
+ Name = attr.Name,
+ OldName = attr.OldName,
+ _DisableSyncStructure = attr._DisableSyncStructure,
+ AsTable = attr.AsTable
+ }
+ };
_orm.Aop.ConfigEntityHandler(_orm, aope);
var tryattr = aope.ModifyResult;
if (!string.IsNullOrEmpty(tryattr.Name)) attr.Name = tryattr.Name;
@@ -171,7 +180,31 @@ namespace FreeSql.Internal
case MappingPriorityType.Aop:
if (_orm.Aop.ConfigEntityPropertyHandler != null)
{
- var aope = new Aop.ConfigEntityPropertyEventArgs(type, proto);
+ var aope = new Aop.ConfigEntityPropertyEventArgs(type, proto)
+ {
+ ModifyResult = new ColumnAttribute
+ {
+ Name = attr.Name,
+ OldName = attr.OldName,
+ DbType = attr.DbType,
+ _IsPrimary = attr._IsPrimary,
+ _IsIdentity = attr._IsIdentity,
+ _IsNullable = attr._IsNullable,
+ _IsIgnore = attr._IsIgnore,
+ _IsVersion = attr._IsVersion,
+ MapType = attr.MapType,
+ _Position = attr._Position,
+ _CanInsert = attr._CanInsert,
+ _CanUpdate = attr._CanUpdate,
+ ServerTime = attr.ServerTime,
+ _StringLength = attr._StringLength,
+ InsertValueSql = attr.InsertValueSql,
+ _Precision = attr._Precision,
+ _Scale = attr._Scale,
+ RewriteSql = attr.RewriteSql,
+ RereadSql = attr.RereadSql
+ }
+ };
_orm.Aop.ConfigEntityPropertyHandler(_orm, aope);
var tryattr = aope.ModifyResult;
if (!string.IsNullOrEmpty(tryattr.Name)) attr.Name = tryattr.Name;