-5

Here is my sql query i want to convert it into lambda expression

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

Thanks in advance .

1
  • How can someone convert it to lambda expression without knowing your objects their properties etc? Atleast post your class structure and tell us what you have tried and the error that you are facing while doing that. If you need a tutorial on Lamda expressions that search google Commented Jul 14, 2013 at 10:44

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.