Entity Framework Query for inner join

后端 未结 3 1564
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 19:22

What would be the query for:

select s.* from Service s 
inner join ServiceAssignment sa on sa.ServiceId = s.Id
where  sa.LocationId = 1

in

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 20:07

    You could use a navigation property if its available. It produces an inner join in the SQL.

    from s in db.Services
    where s.ServiceAssignment.LocationId == 1
    select s
    

提交回复
热议问题