Modelling TPH

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.

Image

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.

Image
Image

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:

Image
Image

Set a condition. You only want baked goods in the BakedGood entity, so you need to set the condition in the Mapping Details Window:

Image

Image 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.



Image 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?


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset