Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
8447d96077
  1. 18
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs
  2. 4
      Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

18
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs

@ -565,6 +565,24 @@ namespace SqlSugar
//additem.Value = "";
result.Add(additem);
}
else if (memberAssignment.Expression is MemberInitExpression|| memberAssignment.Expression is NewExpression)
{
var dic = ExpressionTool.GetNewExpressionItemList(memberAssignment.Expression);
foreach (var kv in dic)
{
additem = new NewExpressionInfo();
//var leftInfo = keys[i];
additem.Type = nameof(NewExpression);
additem.RightName = kv.Key;
additem.ShortName = ExpressionTool.GetParameters(kv.Value).First().Name;
additem.RightName = kv.Key;
additem.LeftNameName = memberAssignment.Member.Name + "." + kv.Key;
additem.RightDbName = kv.Key;
//additem.Value = "";
result.Add(additem);
}
}
else
{
var value = baseResolve.GetNewExpressionValue(memberAssignment.Expression);

4
Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

@ -659,6 +659,10 @@ namespace SqlSugar
{
key = item.Name + "." + name;
info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower() == key.ToLower());
if (info == null)
{
info = readerValues.Select(it => it.Key).FirstOrDefault(it => it.ToLower().EndsWith("."+ key.ToLower()));
}
}
var oldInfo = info;
if (mappingKeys != null && mappingKeys.ContainsKey(item.Name))

Loading…
Cancel
Save