Browse Source

Synchronization code

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

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

@ -565,7 +565,25 @@ namespace SqlSugar
//additem.Value = "";
result.Add(additem);
}
else
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);
//var leftInfo = keys[i];

2
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs

@ -104,7 +104,7 @@ namespace SqlSugar
this.Context.SqlTranslationLeft + asName + "." + newExpressionInfo.LeftNameName + this.Context.SqlTranslationRight
);
}
}
else
{
parameter.Context.Result.Append(this.Context.GetAsString(

2
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Property.cs

@ -68,7 +68,7 @@ namespace SqlSugar
if (first.Contains("("))
{
first = first.Split('(').Last().Trim();
}
}
if (!result.ContainsKey(first))
{
result.Add(first, last);

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