复杂Sql的实体框架查询



有人知道如何将其表示为实体框架查询吗?方法语法和查询语法都可以。

Declare @UserId int = 18
Select *
From [Profiles]
Where [Profiles].[ProfileId] 
IN( Select [SecurityProfileAssignments].[ProfileId]
    From [SecurityProfileUsers]
    Join [SecurityProfileAssignments] On [SecurityProfileAssignments].[SecurityProfileId] = [SecurityProfileUsers].[SecurityProfileId]
    Where [SecurityProfileUsers].[UserId] = @UserId)

给定变量userId:

from p in Profiles
join spa in SeucrityProfileAssignments
    on p.ProfileId equals spa.ProfileId
join spu in SecurityProfileUsers
    on spa.SecurityProfileId equals spu.SecurityProfileId
where spu.UserId = userId
select new //optional object type
{
    //values to select
}

相关内容

  • 没有找到相关文章

最新更新