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;