简体   繁体   English

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

[英]Entity Framework Code First 0 to 1 mapping

I want to create a map of these 2 models, how do I do this in code-first? 我想创建这两个模型的地图,我该如何在代码优先?

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 can be either of type PaymentBank or PaymentCheque . Payment可以是PaymentBankPaymentCheque I'm trying to follow a scenario like this . 我试图按照类似的情景这样 I'd love if I could do inheritance of this if possible, such as: 如果可能的话,如果我可以继承这个,我会很高兴,例如:

public class PaymentCheque : Payment
{
    public int RoutingNumber {get; set;}
}   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM