我正在努力解决以下问题。linq声明与两个where子句
public class Competition
{
public int Id { get; set; }
public string Name { get; set; }
public IList<ResultInfo> ResultInfos { get; set; }
public IList<Event> ChildEvents { get; set; }
}
public class ResultInfo
{
public int Id { get; set;}
public string ResultInfoName { get; set;}
public int Season { get; set; }
}
public class Event
{
public int Id { get; set; }
public string EventName { get; set; }
public IList<ResultInfo> ResultInfos { get; set; }
}
我在尝试查询如下,试图从比赛和事件中获得结果信息的赛季“2013”。如果有人知道,请告知。
if (year.HasValue)
{
model = model.Where(x => x. ??
}
你会那么需要来连接直接存储在竞争对象中的ResultInfos的结果。 (competition.ResultInfos.Where(ri => ri.Season == 2013)); – 2013-04-23 10:24:44
“竞争”中的ResultInfo如何? – 2013-04-23 10:24:55
@vonv - 不错的地方。 – 2013-04-23 10:26:21