5

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?

Wim Simons
  • 51
  • 1

1 Answers1

1

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

Example

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

Model

With this you can create the Table per hierarchy model.

Overmachine
  • 1,723
  • 3
  • 15
  • 27