- 增加 IUpdate.Join 联表更新功能;

This commit is contained in:
2881099
2023-03-10 20:42:32 +08:00
parent 39bb327022
commit a6c1981bd6
7 changed files with 627 additions and 14 deletions

View File

@ -528,7 +528,7 @@ namespace base_entity
//.UseSlaveWeight(10, 1, 1, 5)
//.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5")
.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5")
//.UseQuoteSqlName(false)
//.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=2")
@ -569,6 +569,15 @@ namespace base_entity
#endregion
fsql.UseJsonMap();
var updatejoin01 = fsql.Update<User1>()
.Join(fsql.Select<UserGroup>(), (a, b) => a.GroupId == b.Id)
.Set((a, b) => a.Nickname == b.GroupName)
.ExecuteAffrows();
var updatejoin02 = fsql.Update<User1>()
.Join<UserGroup>((a, b) => a.GroupId == b.Id)
.Set((a, b) => a.Nickname == b.GroupName)
.ExecuteAffrows();
fsql.Select<User1>().IncludeMany(a => a.Roles);
var displayNameTb = fsql.CodeFirst.GetTableByEntity(typeof(DeviceCodes));