mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-25 01:14:33 +08:00
Update Core
This commit is contained in:
parent
c3b7a169c8
commit
2cb2520b4e
@ -1332,6 +1332,10 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public List<T> SetContext<ParameterT>(Expression<Func<T, object>> thisFiled, Expression<Func<object>> mappingFiled, ParameterT parameter)
|
public List<T> SetContext<ParameterT>(Expression<Func<T, object>> thisFiled, Expression<Func<object>> mappingFiled, ParameterT parameter)
|
||||||
{
|
{
|
||||||
|
if (parameter == null)
|
||||||
|
{
|
||||||
|
return new List<T>();
|
||||||
|
}
|
||||||
List<T> result = new List<T>();
|
List<T> result = new List<T>();
|
||||||
var entity = this.Context.EntityMaintenance.GetEntityInfo<ParameterT>();
|
var entity = this.Context.EntityMaintenance.GetEntityInfo<ParameterT>();
|
||||||
var queryableContext = this.Context.TempItems["Queryable_To_Context"] as MapperContext<ParameterT>;
|
var queryableContext = this.Context.TempItems["Queryable_To_Context"] as MapperContext<ParameterT>;
|
||||||
@ -1346,7 +1350,7 @@ namespace SqlSugar
|
|||||||
pkName = ((mappingFiled as LambdaExpression).Body as MemberExpression).Member.Name;
|
pkName = ((mappingFiled as LambdaExpression).Body as MemberExpression).Member.Name;
|
||||||
}
|
}
|
||||||
var key = thisFiled.ToString() +typeof(ParameterT).FullName + typeof(T).FullName;
|
var key = thisFiled.ToString() +typeof(ParameterT).FullName + typeof(T).FullName;
|
||||||
var ids = list.Select(it => it.GetType().GetProperty(pkName).GetValue(it)).ToArray();
|
var ids = list.Where(it=>it!=null).Select(it => it.GetType().GetProperty(pkName).GetValue(it)).Distinct().ToArray();
|
||||||
if (queryableContext.TempChildLists == null)
|
if (queryableContext.TempChildLists == null)
|
||||||
queryableContext.TempChildLists = new Dictionary<string, object>();
|
queryableContext.TempChildLists = new Dictionary<string, object>();
|
||||||
if (list != null && queryableContext.TempChildLists.ContainsKey(key))
|
if (list != null && queryableContext.TempChildLists.ContainsKey(key))
|
||||||
|
Loading…
Reference in New Issue
Block a user