我可以使用Entity Framework Code First映射以下域模型吗?
public abstract class ContentBase { ... }
public class ContentA : ContentBase { ... }
public class ContentB : ContentBase { ... }
public interface IContainer<out TContent>
where TContent : ContentBase { ... }
public abstract class ContainerBase<TContent> : IContainer<TContent>
where TContent : ContentBase
{
public IList<TContent> Items { get; }
}
public class ContainerA : ContainerBase<ContentA> { ... }
public class ContainerB : ContainerBase<ContentB> { ... }
public class Apple
{
public IList<IContainer<ContentBase>> Stuff { get; }
}
public class Orange
{
public IContainer<ContentBase> Stuff { get; set; }
}
我已经实现了我的域模型,但我还没有开始将它映射到数据库。今天我读到Entity Framework无法映射输入为接口的属性,所以我担心在进行映射时会遇到麻烦。