问题描述
我正在遵循下面列出的Code First Tutorial: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-and-chosen-strategy-guidelines.aspx教程
使用名为BillingDetails的基类和两个子类CreditCards和BankAccounts。继承和保存数据工作正常。但是生成了3个表,每个表一个。正如所料,基类BillingDetails不包含任何数据。据我了解,
永远不会。代码是否有问题,或者TPC需要这个空表吗?如果这个表可以删除,有人可以告诉我怎么样?
I am following the Code First Tutorial listed below: 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-and-choosing-strategy-guidelines.aspx The tutorial uses a base class named BillingDetails and two subclasses CreditCards and BankAccounts. Inheritance and saving data work fine. But 3 tables were generated, one for each class. As expected, the base class, BillingDetails, contains no data. As I understand it, never will. Is there a problem with the code, or is this empty table required for TPC to work? If this table can be removed, could someone please tell me how?
这篇关于代码优先TPC - 基本表生成虽然它从不包含数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!