这是我的sql查询,我想将其转换为lambda表达式
Select P.PlaceName As UnitNumber,
PB.PlaceName,
A.Locality,
A.SubLocality,
A.Sublocality_Level_1
from Listing L
inner join Place P ON L.PlaceId = P.Id
Inner Join Place PB ON PB.Id = P.ParentPlaceId
Inner Join [Address] A ON A.Id = PB.AddressId
Where L.Id =9
提前致谢。
答案 0 :(得分:0)
在这种情况下,查询表达式要简单得多。我不建议你使用带有许多连接的lambdas
from l in db.Listing
join p in db.Place on l.PlaceId equals p.Id
join pb in db.Place on p.ParentPlaceId equals pb.Id
join a in db.Address on pb.AddressId equals a.Id
where l.Id == 9
select new {
UnitNumber = p.PlaceName,
pb.PlaceName,
a.Locality,
a.SubLocality,
a.Sublocality_Level_1
}
db
是您的背景