mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
修复 查询重复数据时使用 IncludeMany 出现字典重复添加的 bug;
This commit is contained in:
parent
68ab673870
commit
4213761c62
@ -123,6 +123,11 @@
|
||||
手工绑定 ManyToMany 导航关系
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:FreeSql.DataAnnotations.OraclePrimaryKeyNameAttribute.Name">
|
||||
<summary>
|
||||
主键名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:FreeSql.DataAnnotations.TableAttribute.Name">
|
||||
<summary>
|
||||
数据库表名
|
||||
|
@ -708,12 +708,16 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<string, Tuple<T1, List<TNavigate>>> dicList = new Dictionary<string, Tuple<T1, List<TNavigate>>>();
|
||||
Dictionary<string, List<Tuple<T1, List<TNavigate>>>> dicList = new Dictionary<string, List<Tuple<T1, List<TNavigate>>>>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (tbref.Columns.Count == 1)
|
||||
{
|
||||
dicList.Add(getListValue(item, tbref.Columns[0].CsName, 0).ToString(), Tuple.Create(item, new List<TNavigate>()));
|
||||
var dicListKey = getListValue(item, tbref.Columns[0].CsName, 0).ToString();
|
||||
var dicListVal = Tuple.Create(item, new List<TNavigate>());
|
||||
if (dicList.TryGetValue(dicListKey, out var items) == false)
|
||||
dicList.Add(dicListKey, items = new List<Tuple<T1, List<TNavigate>>>());
|
||||
items.Add(dicListVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -723,7 +727,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (z > 0) sb.Append("*$*");
|
||||
sb.Append(getListValue(item, tbref.Columns[z].CsName, z));
|
||||
}
|
||||
dicList.Add(sb.ToString(), Tuple.Create(item, new List<TNavigate>()));
|
||||
var dicListKey = sb.ToString();
|
||||
var dicListVal = Tuple.Create(item, new List<TNavigate>());
|
||||
if (dicList.TryGetValue(dicListKey, out var items) == false)
|
||||
dicList.Add(dicListKey, items = new List<Tuple<T1, List<TNavigate>>>());
|
||||
items.Add(dicListVal);
|
||||
sb.Clear();
|
||||
}
|
||||
}
|
||||
@ -756,14 +764,17 @@ namespace FreeSql.Internal.CommonProvider
|
||||
key = sb.ToString();
|
||||
sb.Clear();
|
||||
}
|
||||
if (dicList.TryGetValue(key, out var t1item) == false) return;
|
||||
if (dicList.TryGetValue(key, out var t1items) == false) return;
|
||||
foreach (var t1item in t1items)
|
||||
t1item.Item2.Add(nav);
|
||||
|
||||
//将子集合的,多对一,对象设置为当前对象
|
||||
foreach (var parentNav in parentNavs)
|
||||
foreach (var t1item in t1items)
|
||||
_orm.SetEntityValueWithPropertyName(tbref.RefMiddleEntityType, nav, parentNav, t1item.Item1);
|
||||
}
|
||||
foreach (var t1item in dicList.Values)
|
||||
foreach (var t1items in dicList.Values)
|
||||
foreach (var t1item in t1items)
|
||||
setListValue(t1item.Item1, t1item.Item2);
|
||||
dicList.Clear();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user