I have been dipping into Microsoft’s Entity Framework

Microsoft Entity Framework in Action
for a little while, but until now most of my EF applications have been pretty simple. For some of my current projects,I’ve wanted to get a better understanding of how the new version of EF works and gain insight into how it managed my data for me. I decided to get the MEAP version of
Manning’s Microsoft Entity Framework in Action book by Stefano Mostarda and Marco De Sanctis and see what all it covered. After purchasing and using several
MEAP books from Manning, I really think they are a great value and allow you to gain access to the texts before they have been published.
The book is broken into four parts, each building on the knowledge gained from the previous section. Part 1 of the book is an introduction to O/RMs and a quick guide as to what they provide developers. The coverage in this section is to help you get a better understanding of the Object/Relational Mismatch that occurs in applications and how solutions such as EF are developed to help with this mismatch. At the end of this section you will build the structure for a sample app that will be referenced throughout the book. This is a simple order application but it is used intelligently and explained in such a way that makes referencing it later helpful for understanding how EF usage is a benefit to the project.
Part 2 quickly starts diving into EF and guiding the reader through querying and understanding the model. In addition, it goes into the mechanics used for persistence and concurrency via EF. I’ll be referencing this section quite often due to all the examples that are included for dealing with data via querying, such as grouping, sorting and projecting results for ease of use. After the querying sections you are guided through the Entity Data Model (EDM) and how it is constructed and described using its different parts: Conceptual Model (CSDL), Storage Model (SSDL) and the Mapping (MSL). In most cases developers will use the Designer and the EDMX file generated in Visual Studio. Having an understanding of how the XML is built and how to build one manually, however, can really help when you want to make tweaks outside of the designer, such as extending the EDM with custom annotations.
In the last two chapters of this section the book goes into Persistence and Concurrency via EF. The persistence was one of the most interesting areas of the book for me (due to my DBA experiences). I think that too many times we use frameworks like EF without understanding the impact that some of our coding makes on the data store of our applications. These two sections give the reader a better understanding of how,and when, entities are marked in such a way that SQL calls will be made to the database for managing them. Having a better understanding of EntityState and ObjectStateManager can help a developer in mitigating the number of calls that will be made to the database by making sure that objects are marked correctly before calling SaveChanges methods. Also, through some of the techniques described for managing concurrency and transactions in your EF application, including managing entities in a disconnected manner, you can help ensure that the application works as expected.
Part 3 of the book focuses on some of the more advanced topics of EF including Entity SQL, usage of Functions and Stored Procedures in your model, querying the EDM programmatically, and customizing the EF code and designer. I was mainly interested the usage of Functions and Stored Procedures here. The book does a good job of providing the reader with several examples for mapping and consuming SPROCs from EF; including selecting data, updating entities and building functions that can be used against the inheritance hierarchy that you defined in your application.
The final section of the book walks you through bringing all of this new found EF knowledge together for building the order application. The authors did a good job of presenting not only their example application, but also providing the reader with meaningful information that can be used for building application architectures that use EF. Chapters include ASP .NET, Windows Applications and how to integrate EF with a traditional n-tier application. The last chapter provides helpful information on building unit tests against your EF enabled application.
I would recommend the book for those who are looking to increase their understanding of Microsoft’s Entity Framework. The book is not only a walk-through of how to build and use EF, it also provides the reader with a lot of reference material that can be used in day-to-day development work. I plan on referencing the “Working with Entity Framework” section quite often on my next project with EF in my attempts to streamline all data transactions that occur in my application when dealing with my entities.