var users = from user in st.Users
where user.UDID == cr.User.Udid
select user;
var cityIds from city in users.First().Cities
select city.ID;
DoSomethingWith(cityIds);
It started as this query:
select CityID from UserCities inner join User on User.ID=UserID where User.UDID=@UDID;
I can’t seem to get the join syntax right with Linq-to-Entities
Using query expressions isn’t really helping you here, and you wouldn’t need two of them anywehere. Here’s a direct translation:
Now use the fact that
Firstcan take a predicate, and you can remove theWhere: