实体框架代码第一个0到1映射

| 我想创建这两个模型的映射,如何在代码优先的情况下执行此操作?
public class Payment
{
    public int PaymentId { get; set; }
}

public class PaymentBank
{
    public int PaymentId { get; set; }
}

public class PaymentCheque
{
    public int PaymentId { get; set; }
}
Payment
可以是
PaymentBank
PaymentCheque
类型。我正在尝试遵循这样的方案。如果可以,我希望可以继承它,例如:
public class PaymentCheque : Payment
{
    public int RoutingNumber {get; set;}
}   
    
已邀请:
您可以查看以下三篇文章,重点介绍如何在Entity Framework Code-First中实现继承: http://weblogs.asp.net/manavi/archive/2010/12/24/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph。 aspx http://weblogs.asp.net/manavi/archive/2010/12/28/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt。 aspx http://weblogs.asp.net/manavi/archive/2011/01/03/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-3-table-per-concrete-type- tpc和选择策略准则     
您确实尝试过吗?还是搜索/搜索它? 参见:http://weblogs.asp.net/manavi/archive/2010/12/24/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy- tph.aspx     

要回复问题请先登录注册