mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 优化 Aop.ConfigEntity 使用 ModifyResult 访问最新的设置;#1247
This commit is contained in:
parent
832f8a21a6
commit
ef371af480
@ -134,7 +134,7 @@ namespace FreeSql.Aop
|
||||
/// <summary>
|
||||
/// 实体配置
|
||||
/// </summary>
|
||||
public TableAttribute ModifyResult { get; }
|
||||
public TableAttribute ModifyResult { get; internal set; }
|
||||
/// <summary>
|
||||
/// 索引配置
|
||||
/// </summary>
|
||||
@ -160,7 +160,7 @@ namespace FreeSql.Aop
|
||||
/// <summary>
|
||||
/// 实体的属性配置
|
||||
/// </summary>
|
||||
public ColumnAttribute ModifyResult { get; }
|
||||
public ColumnAttribute ModifyResult { get; internal set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user