【发布时间】:2011-09-26 18:42:52
【问题描述】:
我有一个名为 Tag 的实体,其导航属性(集合)名为 Articles。 Tag 有一个名为 ArticleCount 的被忽略属性,用于保存关联的 Article 的计数(只是在运行中-时间并在视图中使用 - 忽略数据库)。见:
public class Tag{
public int Id { get; set; }
public int Title { get; set; }
public virtual ICollection<Article> Articles { get; set; }
[NotMapped]
public int ArticleCount { get; set; }
}
如何在 ONE 查询中选择所有 Tag (或一个)以及它的 ArticleCount -in entity framework 4.1 code-first,带有 lambda 表达式好吗?
【问题讨论】:
标签: lambda entity-framework-4.1 ef-code-first code-first navigation-properties