Chapter 8. Implementing a More Real-World Model

In the previous chapters, we discussed the core concepts of the Entity Framework, including the Entity Data Model (EDM), querying, and other straightforward operations. We used a simple database and console application to illustrate key points and keep you focused on the lessons. Now it’s time to look at some more real-world scenarios.

In this chapter, we’ll create a more realistic EDM based on a database of the kind you’re more likely to encounter in your work. The model is based on a more complex sdatabase—the BreakAway database—designed to support a fictional travel agency. With a more complex database, you must typically tweak the EDM you create to resolve naming conflicts and other issues. More complex databases are also likely to contain many-to-many relationships and additional stored procedures, both of which you’ll learn how to handle in this and later chapters.

We’ll build the model using the database-first approach as we did with the sample model in Chapter 2.

Note

Chapter 25 will teach you how to do model-first design, where you define an Entity Data Model from scratch and build a database from that model, and code-first design, which leverages the Entity Framework without using a designer-based model.

Finally, the model will be contained in its own assembly so that you can reuse it. We’ll use the model and add to it throughout the rest of the book.

The model you will build here, though more realistic than the sample model of ...

Get Programming Entity Framework, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.