【发布时间】:2015-11-11 12:35:24
【问题描述】:
我喜欢执行如下所示的链式查询 我已经给出了大陆 ID,并据此选择了一个:
var continent = db.Continent.FirstOrDefault(c => c.Id == Continent_Id);
然后我想找到给定大陆的国家子集。 然后我想根据国家 ID 查找给定国家的城市子集。任何想法如何做到这一点? 这些是我的课程:
public class Contient
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
public int ContientId { get; set; }
}
public class City
{
public int Id { get; set; }
public string Name { get; set; }
public int CountryId { get; set; }
}
【问题讨论】:
标签: c# linq model-view-controller