Browse Source

Update join

pull/32/head
sunkaixuan 2 years ago
parent
commit
71e2bd79b3
  1. 7
      Src/Asp.NetCore2/MySqlTest/Demo/Demo2_Updateable.cs
  2. 8
      Src/Asp.NetCore2/SqlSeverTest/Demo/Demo2_Updateable.cs
  3. 2
      Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableProviderT2.cs

7
Src/Asp.NetCore2/MySqlTest/Demo/Demo2_Updateable.cs

@ -66,8 +66,11 @@ namespace OrmTest
var result8 = db.Updateable<Order>(it => it.Name == "Name" + "1").Where(it => it.Id == 1).ExecuteCommand();
var result81 = db.Updateable<Order>().SetColumns(it => it.Name == "Name" + "1").Where(it => it.Id == 1).ExecuteCommand();
//
var result61 = db.Updateable<Order>()
.InnerJoin<Custom>((x, y) => x.CustomId == y.Id)
.SetColumns((x, y) => new Order() { Name = y.Name, Price = y.Id })
.Where((x, y) => x.Id == 1)
.ExecuteCommand();
/*** 3.by Dictionary ***/

8
Src/Asp.NetCore2/SqlSeverTest/Demo/Demo2_Updateable.cs

@ -66,9 +66,11 @@ namespace OrmTest
var result8 = db.Updateable<Order>(it => it.Name == "Name" + "1").Where(it => it.Id == 1).ExecuteCommand();
var result81 = db.Updateable<Order>().SetColumns(it => it.Name == "Name" + "1").Where(it => it.Id == 1).ExecuteCommand();
//
var result61 = db.Updateable<Order>()
.InnerJoin<Custom>((x, y) => x.CustomId == y.Id)
.SetColumns((x, y) => new Order() { Name = y.Name, Price=y.Id })
.Where((x, y) => x.Id == 1)
.ExecuteCommand();
/*** 3.by Dictionary ***/
var dt = new Dictionary<string, object>();

2
Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateableProviderT2.cs

@ -36,7 +36,7 @@ namespace SqlSugar
foreach (var item in items)
{
var dbColumnName=updateableObj.UpdateBuilder.Context.EntityMaintenance.GetDbColumnName<T>(item.Key);
var value = updateableObj.UpdateBuilder.GetExpressionValue(item.Value, ResolveExpressType.WhereMultiple).GetString();
var value = updateableObj.UpdateBuilder.GetExpressionValue(ExpressionTool.RemoveConvert(item.Value), ResolveExpressType.WhereMultiple).GetString();
this.updateableObj.UpdateBuilder.SetValues.Add(new KeyValuePair<string, string>(dbColumnName, value));
}
UpdateBuilder.DbColumnInfoList = UpdateBuilder.DbColumnInfoList

Loading…
Cancel
Save