【发布时间】:2018-08-13 13:43:19
【问题描述】:
public class Entity1
{
public int Id { get; set; }
public Guid EntityKey { get; set; }
public ICollection<Entity2> Entity2s { get; set; }
}
public class Entity2
{
public int Id { get; set; }
public Guid EntityKey { get; set; }
}
public class EntityMapping
{
public int Id { get; set; }
public Guid ParentKey { get; set; }
public EntityType ParentType { get; set; }
public Guid ChildKey { get; set; }
public EntityType ChildType { get; set; }
}
我需要使用 fluent 配置 API 做一些事情来执行:
select e2.* from Entity1 e1
join Entitymapping em on em.ParentKey == e1.EntityKey && em.ParentType == 'Entity1'
join Entity2 e2 on em.ChildKey == e2.EntityKey
当我打电话时:entity1.Entity2s.ToList()
仅使用 EF 4 中的 fluent 配置是否也能做到这一点?
【问题讨论】:
标签: c# entity-framework entity-framework-4