I have 3 Tables:
Region:
ID,
Name
District
ID,
RegionID,
Name
City
ID,
DistrictID,
Name
When I write like this:
var result = (from item in db.Region.Include("District.City")
select item).ToList();
In result I have objects dependent on each other开发者_Python百科
For example: In Region
I have 2 objects, in District
4 objects and in City
8 objects
I want to write this with Linq Join, not with include()
Can you help me??
You can use join instead of include, but your relations won't change
var result = from r in db.Region
join d in db.District on r.ID equals d.RegionID
join c in db.City on d.ID equals c.DistrictID
where r.ID == 1
select r;
精彩评论