convert sql query into lambda expression [closed]

Query expression is much simpler in this case. I don’t recommend you to use lambdas with many joins

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 is your context

Browse More Popular Posts

Leave a Comment