【发布时间】:2012-04-11 01:05:53
【问题描述】:
我下面的代码有什么问题?即使数据库中存在匹配的记录,它也不会返回任何项目。如果错了,如何将我的IQueryable 转换为IEnumerable?
public IEnumerable<TimelineItem> TimeLineItems { get; set; }
public IEnumerable<TimelineItem> GetTimeLineItems(int SelectedPID)
{
TimeLineItems = (from t in db.TimelineItems
where t.ProductID == SelectedPID
select new { t.Description, t.Title }) as IEnumerable<TimelineItem>;
return TimeLineItems;
}
【问题讨论】:
标签: linq entity-framework c#-4.0