我正在尝试用两个表做出请求
表页:Id,LangId(主键)PageTypeId,PageTypeLangId(外键)
表PageType:Id,LangId(主键)
那怎么办?在这里,我想念只是添加PageTypeLangId
return context.Pages
.Join(context.PageTypes, p => p.PageTypeId, pT => pT.Id,(p, pT) => new { p, pT })
Run Code Online (Sandbox Code Playgroud)
我想要 :
select * from Page inner join PageType on Page.PageTypeId=PageType.Id and Page.PageTypeLangId=PageType.LangId
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助 !
Dan*_*rth 11
以下应该有效:
return context.Pages
.Where(x => x.PageTypeLangId.HasValue)
.Join(context.PageTypes,
p => new { Id = p.PageTypeId,
LangId = p.PageTypeLangId.Value },
pT => new { pT.Id, pT.LangId },
(p, pT) => new { p, pT });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7435 次 |
| 最近记录: |