mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-11 19:01:00 +08:00
- 修复 Aop.ConfigEntity 对索引特性的重写;
This commit is contained in:
@@ -175,13 +175,13 @@ namespace FreeSql.Internal
|
|||||||
case MappingPriorityType.Aop:
|
case MappingPriorityType.Aop:
|
||||||
if (_orm.Aop.ConfigEntityHandler != null)
|
if (_orm.Aop.ConfigEntityHandler != null)
|
||||||
{
|
{
|
||||||
var aopeIndexsPriorityTypes = new List<MappingPriorityType>();
|
var aopBeforeTypes = new List<MappingPriorityType>();
|
||||||
foreach (var aipt in _mappingPriorityTypes)
|
foreach (var aipt in _mappingPriorityTypes)
|
||||||
{
|
{
|
||||||
if (aipt == MappingPriorityType.Aop) break;
|
if (aipt == MappingPriorityType.Aop) break;
|
||||||
else aopeIndexsPriorityTypes.Add(aipt);
|
else aopBeforeTypes.Add(aipt);
|
||||||
}
|
}
|
||||||
var aopeIndexs = GetEntityIndexAttribute(type, aopeIndexsPriorityTypes.ToArray());
|
var aopeIndexs = GetEntityIndexAttribute(type, aopBeforeTypes);
|
||||||
var aope = new Aop.ConfigEntityEventArgs(type)
|
var aope = new Aop.ConfigEntityEventArgs(type)
|
||||||
{
|
{
|
||||||
ModifyResult = new TableAttribute
|
ModifyResult = new TableAttribute
|
||||||
@@ -420,7 +420,25 @@ namespace FreeSql.Internal
|
|||||||
if (attr.ManyToMany != null) ret = attr;
|
if (attr.ManyToMany != null) ret = attr;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public IndexAttribute[] GetEntityIndexAttribute(Type type, MappingPriorityType[] mappingPriorityTypes = null)
|
public IndexAttribute[] GetEntityIndexAttribute(Type type)
|
||||||
|
{
|
||||||
|
//计算 Aop 优先级后面的配置
|
||||||
|
var aopAfterTypes = new List<MappingPriorityType>();
|
||||||
|
var isAopFirst = false;
|
||||||
|
foreach (var aipt in _mappingPriorityTypes)
|
||||||
|
{
|
||||||
|
if (aipt == MappingPriorityType.Aop)
|
||||||
|
{
|
||||||
|
isAopFirst = true;
|
||||||
|
aopAfterTypes.Add(aipt);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isAopFirst) aopAfterTypes.Add(aipt);
|
||||||
|
}
|
||||||
|
var indexs = GetEntityIndexAttribute(type, aopAfterTypes);
|
||||||
|
return indexs;
|
||||||
|
}
|
||||||
|
IndexAttribute[] GetEntityIndexAttribute(Type type, IEnumerable<MappingPriorityType> mappingPriorityTypes)
|
||||||
{
|
{
|
||||||
if (mappingPriorityTypes == null) mappingPriorityTypes = _mappingPriorityTypes;
|
if (mappingPriorityTypes == null) mappingPriorityTypes = _mappingPriorityTypes;
|
||||||
var ret = new Dictionary<string, IndexAttribute>();
|
var ret = new Dictionary<string, IndexAttribute>();
|
||||||
|
|||||||
Reference in New Issue
Block a user