Sha*_*ean 6 .net c# ef-code-first entity-framework-4.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; }
}
Run Code Online (Sandbox Code Playgroud)
Payment可以是类型PaymentBank或PaymentCheque.我试图按照类似的情景这样.如果可能的话,如果我能继承这个,我会很高兴,例如:
public class PaymentCheque : Payment
{
public int RoutingNumber {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
您可以查看以下三篇文章,重点介绍在实体框架代码优先中实现继承:
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-实体框架代码第一-ctp5-part-3-table-per-concrete-type-tpc-and-choosing-strategy-guidelines.aspx
| 归档时间: |
|
| 查看次数: |
752 次 |
| 最近记录: |