diff --git a/FreeSql/Interface/IAop.cs b/FreeSql/Interface/IAop.cs
index 20afe48e6..faf11507c 100644
--- a/FreeSql/Interface/IAop.cs
+++ b/FreeSql/Interface/IAop.cs
@@ -138,7 +138,7 @@ namespace FreeSql.Aop
///
/// 索引配置
///
- public List ModifyIndexResult { get; }
+ public List ModifyIndexResult { get; internal set; }
}
public class ConfigEntityPropertyEventArgs : EventArgs
{
diff --git a/FreeSql/Internal/CommonUtils.cs b/FreeSql/Internal/CommonUtils.cs
index dd93f7010..e1b3c643c 100644
--- a/FreeSql/Internal/CommonUtils.cs
+++ b/FreeSql/Internal/CommonUtils.cs
@@ -175,6 +175,13 @@ namespace FreeSql.Internal
case MappingPriorityType.Aop:
if (_orm.Aop.ConfigEntityHandler != null)
{
+ var aopeIndexsPriorityTypes = new List();
+ foreach (var aipt in _mappingPriorityTypes)
+ {
+ if (aipt == MappingPriorityType.Aop) break;
+ else aopeIndexsPriorityTypes.Add(aipt);
+ }
+ var aopeIndexs = GetEntityIndexAttribute(type, aopeIndexsPriorityTypes.ToArray());
var aope = new Aop.ConfigEntityEventArgs(type)
{
ModifyResult = new TableAttribute
@@ -183,7 +190,8 @@ namespace FreeSql.Internal
OldName = attr.OldName,
_DisableSyncStructure = attr._DisableSyncStructure,
AsTable = attr.AsTable
- }
+ },
+ ModifyIndexResult = aopeIndexs.ToList()
};
_orm.Aop.ConfigEntityHandler(_orm, aope);
var tryattr = aope.ModifyResult;
@@ -412,10 +420,11 @@ namespace FreeSql.Internal
if (attr.ManyToMany != null) ret = attr;
return ret;
}
- public IndexAttribute[] GetEntityIndexAttribute(Type type)
+ public IndexAttribute[] GetEntityIndexAttribute(Type type, MappingPriorityType[] mappingPriorityTypes)
{
+ if (mappingPriorityTypes == null) mappingPriorityTypes = _mappingPriorityTypes;
var ret = new Dictionary();
- foreach (var mp in _mappingPriorityTypes)
+ foreach (var mp in mappingPriorityTypes)
{
switch (mp)
{