【发布时间】:2012-08-31 18:43:55
【问题描述】:
给定这样的实体:
public class Entity
{
public int Id { get; set; }
public ICollection<EntityTwo> EntityTwos { get; set; }
}
public class EntityTwo
{
public int Id { get; set; }
public int TypeId { get; set; }
public int EntityId { get; set; }
}
通常,Entity.EntityTwos 将返回 EntityId 等于 Entity.Id 的所有 EntityTwo 实体。是否可以装配模型,以便属性返回在该 Id 上加入的实体,但也有 EntityTwo.TypeId == 2(本质上是在加入中添加 where 子句)?
【问题讨论】:
标签: .net linq entity-framework linq-to-entities ef-code-first