表:
我正在寻找此SQL查询的等效EF表达式:
Select *
from File
where fk_iduser = 1
and idfile in (Select fk_idfile
from File_Deco
where fk_idFile in (Select fk_iDfile from Fav))
答案 0 :(得分:1)
使用以下代码:
file=db.file.Where(u => u.fk_iduser == idCurrentUser);
var res=file.Where(f => f.Categ != null && f.Categ.File.FirstOrDefault(ff=>ff.FAV.FirstOrDefault(aa=>aa.fk_iduser==idCurrentUser && aa.fk_idFile==f.idFile)!=null)!=null);