本文介绍了加入实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
这是我的正常加入查询
SELECT Folders.FolderName,FileMaster.FileName FROM FileMaster INNER JOIN 文件夹 ON FileMaster.FolderId = Folders.Id AND FileMaster .UploadedBy = Folders.UserId
如何写实体框架工作像: -
var query = 来自 f db.Folders
join fm in db.FileMasters on f.Id equals fm.FolderId
其中 fm.UploadedBy == SessionManager.UserId
选择 f;
解决方案
var query = from f in db.Folders
join fm in db.FileMasters
new {f.Id,f.UserId}
等于 new {fm .FolderId,fm.UploadedBy}
选择 f.FolderName + ; + fm.Filename;
JAFC
Hello,
This is my Normal Join Query
SELECT Folders.FolderName, FileMaster.FileName FROM FileMaster INNER JOIN Folders ON FileMaster.FolderId = Folders.Id AND FileMaster.UploadedBy = Folders.UserId
How to write in entity Frame work Like:-
var query = from f in db.Folders join fm in db.FileMasters on f.Id equals fm.FolderId where fm.UploadedBy == SessionManager.UserId select f;
解决方案
var query = from f in db.Folders join fm in db.FileMasters on new { f.Id, f.UserId } equals new { fm.FolderId, fm.UploadedBy } select f.FolderName + ";" + fm.Filename;
JAFC
这篇关于加入实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!