Entity Framework 6 Recipes 2nd Ed

Authors: Brian Discoll, Nitin Gupta, Robert Vettor, Zeeshan Hirani, Larry Tenny
Publisher: Apress
Pages: 511
ISBN: 978-1430257882
Aimed at: developers who want to do more with Entity Framework
Rating: 4.5
Reviewed by: Kay Ewbank

Entity Framework provides a good way of creating data projects for .NET, but this book works on the principle that there's no need to reinvent the wheel; use the work someone else has done.


Entity Framework provides a good way of creating data projects for .NET, but this book works on the principle that there’s no need to reinvent the wheel; use the work someone else has done. To produce the book, the authors took the questions that were posted most regularly to forums about Entity Framework, and put together a set of recipes – solutions to those problems.

Entity Framework users will know that it provides three routes to creating projects – code first, database first, and model first. The examples in the book concentrate mainly on the first two on the basis that most database apps use one or the other of them. What’s more, many of the examples show how to work with EF on what the authors call ‘challenged’ database designs – essentially where the way the database has been badly designed but you have to live with it and work around it. It’s a pragmatic approach.

The book is not designed particularly to teach you how to use EF. Instead, its aim is to show you ways to deal with common situations. One thing to point out is that while the word ‘recipes’ in the title suggests that if you just follow the steps exactly you’ll get a working creation, that’s not always the case. It’s better to treat the examples as showing you the technique, but not necessarily the exact code. There are places, particularly in the early chapters, where the code doesn’t give the results the authors suggest. In most cases this is down to the fact that it doesn’t work with a LocalDB database even though that’s what’s used in the sample code. I suspect the authors wrote it using a specific server then generalized it without checking that the code still worked. It’s irritating, but not disastrous so long as you follow the technique being applied.




The book opens with a chapter introducing Entity Framework and what it does, then goes on to a good chapter on modeling fundamentals. This introduces database first and code first modeling, and usefully goes on to show some of EFs cleverer modeling options such as splitting entities among multiple tables and tables among multiple entities. There’s also a good chapter on querying an entity data model.



Chapter 4 is new in this edition and looks at using EF in ASP.NET MVC (Model View Controller). The next chapter concentrates on the different ways you can load entities from your database, and I couldn’t think of any possibility they’d missed. The more complicated modeling and inheritance problems get a chapter to themselves that is also crammed with examples and good ideas. There’s also a rather specific chapter on working with object services that shows how to use the pluralization service and how to work with identifying relationships, which will be useful to anyone with problems in those particular areas, but the next chapter on using your own classes and POCO (Plain Old CLR Objects) is much more generally applicable.

The final group of chapters looks at more advanced topics, starting with– using EF in n-tier apps with WCF and Web API. There’s a good chapter on stored procedures, and one on functions that shows both creating your own functions, and using those of EF and the storage layer.

The book closes with chapters on improving performance, and concurrency. Despite the niggles of code that doesn’t work completely as shown, I liked this book. It concentrates on how to do things, and the code is well written and simple to understand. The examples are well chosen, and overall I recommend it.




The C# Workshop (Packt)

Author: Jason Hales, Almantas Karpavicius and Mateus Viegas
Publisher: Packt
Date: September 2022
Pages: 780
ISBN: 978-1800566491
Print: 1800566492
Kindle: ‎ B0BGRBDJLS
Audience: C# developers
Rating:  4
Reviewer: Mike James
C# is not the language it once was - time for a revival?

Data Structures & Algorithms in Python

Author: Dr. John Canning, Alan Broder and Robert Lafore
Publisher: Addison-Wesley
Date: October 2022
Pages: 928
Print: 013485568X
Kindle: B0B1WJF1K9
Audience: Python developers
Rating: 4
Reviewer: Mike James
Data structures in Python - a good idea!

More Reviews

Last Updated ( Wednesday, 13 August 2014 )