mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 19:15:10 +08:00
Update ContextMethods
This commit is contained in:
parent
9a14754d85
commit
ea65c545d5
@ -486,6 +486,31 @@ namespace SqlSugar
|
||||
));
|
||||
}
|
||||
}
|
||||
else if (!this.Context.IsJoin && (item is MemberInitExpression || item is NewExpression))
|
||||
{
|
||||
List<NewExpressionInfo> newExpressionInfos = new List<NewExpressionInfo>();
|
||||
if (item is MemberInitExpression)
|
||||
{
|
||||
newExpressionInfos = ExpressionTool.GetNewexpressionInfos(item, this.Context);
|
||||
}
|
||||
else
|
||||
{
|
||||
newExpressionInfos = ExpressionTool.GetNewDynamicexpressionInfos(item, this.Context);
|
||||
}
|
||||
mappingKeys = new Dictionary<string, string>();
|
||||
foreach (NewExpressionInfo newExpressionInfo in newExpressionInfos)
|
||||
{
|
||||
//var property=item.Type.GetProperties().Where(it => it.Name == newExpressionInfo.l).First();
|
||||
//asName = GetAsName(item, newExpressionInfo.ShortName, property);
|
||||
mappingKeys.Add("Single_"+newExpressionInfo.LeftNameName,asName + "." + newExpressionInfo.RightDbName );
|
||||
CallContextThread<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
CallContextAsync<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
parameter.Context.Result.Append(this.Context.GetAsString(
|
||||
this.Context.SqlTranslationLeft + asName + "." + newExpressionInfo.RightDbName + this.Context.SqlTranslationRight,
|
||||
newExpressionInfo.RightDbName
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
asName = GetAsNameResolveAnObject(parameter, item, asName, isSameType);
|
||||
|
@ -168,7 +168,10 @@ namespace SqlSugar
|
||||
}
|
||||
catch
|
||||
{
|
||||
result.Add(name, null);
|
||||
if (!result.ContainsKey(name))
|
||||
{
|
||||
result.Add(name, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -447,6 +450,11 @@ namespace SqlSugar
|
||||
key = mappingKeys[item.Name]+"."+typeName + "." + name;
|
||||
info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower() == key.ToLower());
|
||||
}
|
||||
else if (mappingKeys != null && mappingKeys.ContainsKey("Single_" + name))
|
||||
{
|
||||
key =mappingKeys["Single_" + name];
|
||||
info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower() == key.ToLower());
|
||||
}
|
||||
if (info == null&&oldInfo!=null)
|
||||
{
|
||||
info = oldInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user