Here are the three things you need to do to create a TPH model. Only creating the new entity is new to you, and it’s pretty straight=forward. (And we’ll look at it in detail in Chapter 6 when we explore the Model-First Workflow.
Add the new entity. You can use the Entity tool in the toolbox, or right-click on a blank area of the primary design surface and choose Entity from the Add menu. Either way you’ll get a dialog that lets you specify the entity name and its base type.
Move the properties. The technique is the same as the one we used for partitioned entities: Just cut and paste. You’ll need to add the table mapping to the Mapping Details Window, but the designer will know how to map the columns:
Set a condition. You only want baked goods in the BakedGood
entity, so you need to set the condition in the Mapping Details Window:
On Your Own
You know what I’m going to ask you to do now, don’t you? That’s right. Add the model to your sample project.
Take a Break
Entity Data Models can be complex. Very, very complex. But no matter how complex the model becomes, if you’re using the Database-First Workflow, you’ll build it using the techniques you’ve learned in this chapter. (You’ll just use a whole bunch of them in various combinations in the same model.)
Why don’t you take a break before you complete the final review and we move on to the code-side of the equation in the next chapter?