Browse Source

Update dm

pull/30/head
sunkaixuan 2 years ago
parent
commit
b71b413c96
  1. 1
      Src/Asp.Net/DmTest/Demo/Demo2_Updateable.cs
  2. 2
      Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs

1
Src/Asp.Net/DmTest/Demo/Demo2_Updateable.cs

@ -43,6 +43,7 @@ namespace OrmTest
//update all columns by primary key
var result = db.Updateable(updateObj).ExecuteCommand();//update single
var result2 = db.Updateable(updateObjs).ExecuteCommand();//update List<Class>
var result21 = db.Updateable(new List<Order>() { }).ExecuteCommand();
//Ignore Name and Price
var result3 = db.Updateable(updateObj).IgnoreColumns(it => new { it.CreateTime, it.Price }).ExecuteCommand();

2
Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs

@ -28,7 +28,7 @@ namespace SqlSugar
return string.Format("{0} {1} WHERE {2};", updateTable, setValues, string.Join("AND", whereList));
}).ToArray()));
var result= sb.ToString();
if (result == "\r\n")
if (groupList.Count==0)
{
return null;
}

Loading…
Cancel
Save