Udostępnij za pośrednictwem


Sample chapter: Getting to Know the Entity Framework

John Paul Mueller explains the Entity Framework elements, describes the files used to store Entity Framework information, and shows you how to create a simple Entity Framework example, in this chapter from Microsoft ADO.NET Entity Framework Step by Step .

After completing the chapter, you’ll be able to

  • Define what an entity is and why it’s important.
  • Specify the major elements of the Entity Framework.
  • List and describe the files used to store Entity Framework information.
  • Create a simple Entity Framework example.

When an architect wants to design a real-world building by creating a blueprint, one of the tools used to ensure the blueprint is accurate is a model. Often you see a model of the building as part of the presentation for that building. Models are helpful because they help others visualize the ideas that reside in the architect’s head. In addition, the models help the architect decide whether the plan is realistic. Likewise, software developers can rely on models as a means of understanding a software design, determining whether that design is realistic, and conveying that design to others. The Entity Framework provides the means to create various kinds of models that a developer can interact with in a number of ways. As with the architect’s model, the Entity Framework uses a graphical interface to make information about the underlying database structure easier to understand and modify.

The Entity Framework is actually a Microsoft ActiveX Data Object .NET (ADO.NET) technology extension. When you create the model of the database, you also make it possible for the Integrated Development Environment (IDE) to automatically create some of the code required to make the connection between an application and the database real. Because of the way ADO.NET and the Entity Framework interact, it’s possible to create extremely complex designs and then use those designs directly from your code in a way that the developer will understand. There isn’t any need to translate between the levels of abstraction—the Entity Framework performs that task for you.

Before you can begin using the Entity Framework to perform useful work, however, you need to know a little more about it. For one thing, you need to know why it’s called an Entity Framework. It’s also important to know how the various models work and how they’re stored on your system, should you ever need to access them directly. The following sections provide this information and more about the Entity Framework. You’ll then use the knowledge you’ve gained to create a very simple example. This example will help you better understand what the Entity Framework can do because you’ll actually use it to interact with a simple database.

Read the complete chapter here: https://www.microsoftpressstore.com/articles/article.aspx?p=2201639.