how to generate table per hierarchy using entity framework 5 model first

I'm using Visual Studio 2012 with entity Framework 5 model first. I would like to generate my database using a table per hierarchy strategy, but can't find that option. The Entity Designer Database Generation Power Pack is not available for visual studio 2012, or I can't find it.

Anyone a suggestion?


Table Per Hierarchy or commonly known by (TPH) describes mapping inherited types to a single database table (a model entity in your case) that uses a discriminator column to differentiate one subtype from another. When you create inheritance in your model, this is how Code First convention will infer the table mapping by default.

You can accomplish this approach by doing for example

in visual studio .edmx editor, right click on the surface, use the Add –> Entity

例

i added two entities student and professor that the base type is going to be person , after that you should have something like this

模型

With this you can create the Table per hierarchy model.

链接地址: http://www.djcxy.com/p/90238.html

上一篇: 我如何禁用代码第一次迁移

下一篇: 如何使用实体框架5模型首先生成每个层次结构的表