Browse Source

update GetDiffTable

pull/12/head
sunkaixuna 3 years ago
parent
commit
1c27b1ab1c
  1. 3
      Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs
  2. 4
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

3
Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs

@ -68,6 +68,9 @@ namespace OrmTest
db.Updateable<Order>().SetColumns(it=>it.Name=="asdfa").Where(it=>it.Id==1).EnableDiffLogEvent("--update Order--").ExecuteCommand();
db.Updateable<Order>().SetColumns(it => it.Name == "asdfa")
.Where(it =>SqlFunc.Subqueryable<Order>().Where(x=>x.Id==it.Id).Any()).EnableDiffLogEvent("--update Order--").ExecuteCommand();
Console.WriteLine("#### Aop End ####");
}
}

4
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

@ -840,6 +840,10 @@ namespace SqlSugar
if (this.UpdateParameterIsNull)
{
var whereSql = Regex.Replace(sql, ".* WHERE ", "", RegexOptions.Singleline);
if (sql.Contains("WHERE (EXISTS"))
{
whereSql=Regex.Match(sql, @"\(EXISTS.+").Value;
}
dt = this.Context.Queryable<T>().Where(whereSql).AddParameters(parameters).ToDataTable();
}
else

Loading…
Cancel
Save