From 2e6be8b509e66b8402043fa251de3ad8992cccec Mon Sep 17 00:00:00 2001
From: 28810 <2881099@qq.com>
Date: Sun, 28 Sep 2025 14:38:35 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20AOP=20=E4=BC=98?=
=?UTF-8?q?=E5=85=88=E7=BA=A7=E6=9C=80=E9=AB=98=20Aop.ConfigEntity=20?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=20ModifyIndexResult=20?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql/Interface/IAop.cs | 2 +-
FreeSql/Internal/CommonUtils.cs | 15 ++++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
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)
{