- By John Paul Mueller
Getting started with the Entity Framework
The Entity Framework makes it possible to write database applications using less manually written code because the Entity Framework relies on the content of the conceptual model, storage model, and mapping model files to automatically generate classes that an application can use to access the database reliably. The use of the Entity Framework makes developers more productive and generally reduces application errors. In addition, the automation that the Entity Framework provides helps ensure that the application remains up to date. Changes made by the developer or DBA are automatically reflected in the application.
This chapter has introduced you to the Entity Framework. Make sure you understand the three layers—conceptual model, storage model, and model mapping—before you proceed to Chapter 2. Also take time to create the sample application and view the files it creates. The more time you spend interacting with the data that the Entity Framework creates and manages, the better. Of course, all of the work of creating classes is done for you in the background, but it’s still a good idea to know the source of the automation and have an idea of how it works for those situations where the automation doesn’t quite produce the results you expected. As part of working with this chapter, try creating your own project based on data that you already have in a sample database on your system. (Please don’t work with any production data until you’re proficient with the Entity Framework.)
Chapter 2 takes the next natural step in working with the Entity Framework. Instead of simply creating a project and viewing the resulting files, you’re going to begin working with some data by making queries. After all, data stored in a database isn’t useful until you can get it out and display it to an end user in a useful form. Once you complete Chapter 2, you may want to come back to this chapter and use the techniques described here to view the files that the sample in that chapter creates. You’ll see some differences because now you’ll be interacting with the data in a meaningful way. Viewing the differences will add to your knowledge of how the Entity Framework interacts with the database and generates XML to model it.