repository如何分表更新? #815
tiansfather
started this conversation in
General
Replies: 2 comments
-
.ToUpdate() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
repository分表后,使用toupdate仍然更新的是主表
var sql1=manager.Repository.Where(o => o.UserId == CurrentSession.Id && o.Group == group).ToSql(); var sql2=manager.Repository.Where(o => o.UserId == CurrentSession.Id && o.Group == group).ToUpdate().Set(o => o.Readed, true).ToSql();
sql1
"SELECT a.
Id
, a.CreatorUserId
, a.CreatorName
, a.CreationTime
, a.TenantId
, a.UserId
, a.Group
, a.Type
, a.Title
, a.Content
, a.Url
, a.Pic
, a.Readed
, a.Items
\r\nFROMMessage_1
a \r\nWHERE (a.UserId
= 1 AND a.Group
= '任务') AND (a.TenantId
= 1)"sql2
"UPDATE
Message
SETReaded
= ?p_0 \r\nWHERE (Id
in (select * from (SELECT a.Id
\r\nFROMMessage_1
a \r\nWHERE (a.UserId
= 1 AND a.Group
= '任务') AND (a.TenantId
= 1)) ftb_upd)) AND (TenantId
= 1)"Beta Was this translation helpful? Give feedback.
All reactions