Hooked on LINQ

Hooked on LINQ - Developers' Wiki
for .NET Language Integrated Query

Quick Search

Advanced Search »

It’s been a long wait, but Pro LINQ Object-Relational Mapping in C# 2008 by Vijay Mehta (Apress July 2008) has finally arrived, and I was able to purchase the eBook a week ago. (Hopefully the print edition will be in bookstores by now.) This is a book that will teach you how to use LINQ in a practical application. Unlike other books about LINQ that have been published to date, Mehta’s book does not describe LINQ syntax or go into detail about extension methods, lambda expressions and other C# 3.0 language features that make LINQ possible. These are topics with which the reader should be familiar, and there are also a number of excellent books on LINQ and C# 3.0 available that are also listed on this site. (I definitely recommend Pro LINQ in 2008 by Joseph Rattz and LINQ in Action by Fabrice Marguerie, Steve Eichert and Jim Wooley.)

What hasn’t been available until now is a book that shows how to use LINQ for one of its primary design objectives, which is eliminating what has been called the impedance mismatch between objects and databases through object-relational mapping (ORM). This is an area in which the author is an acknowledged expert, and he shows not only how to apply LINQ to ORM, but does so using design patterns, a domain-driven design and unit testing. To my knowledge, no other resource of this scope had been published to date as a book or in any other form.

The book features a real-world example – well, maybe an account management system for the First Bank of Pluto isn’t exactly real-world – that runs over several chapters. Faithful to the objectives that he sets forth in the opening chapters, the application that Mehta develops is completely persistence-ignorant (PI) and also has no user interface (UI), making it an extremely focused study in the application of ORM and domain-driven design.

Adding to the book’s strength, Mehta shows how to develop this application using both LINQ to SQL and LINQ to Entities (a k a ADO.NET 3.5 Entity Framework or EF). In the process, he points out the strengths and weaknesses of both approaches and dispels the widely held perception that LINQ to SQL is simply a RAD tool and that the Entity Framework is the only choice for enterprise applications. The reality is much less clear-cut, and Mehta capably shows that LINQ to SQL is a viable choice in many cases and that both of Microsoft’s ORM frameworks will live a life of their own and hopefully develop independently.

As Mehta notes from the outset, ORM has not been common in the .NET/C# world for two reasons: the lack of native tools with object-oriented and object-persistence capacity. The .NET framework overcame the first of these obstacles, while LINQ now removes the second. How Microsoft’s ORM tools will fare in the future remains to be seen, but Mehta gives them a good chance after giving them a thorough workout. In the closing chapter, he also provides an objective, although brief review of the NHibernate, EntitySpaces and LLBLGen Pro ORM tools as alternatives to LINQ to SQL and Entity Framework.

In closing, this is a book that I recommend to anyone who wants to learn how to use LINQ. It is a book that I have been awaiting eagerly and that far exceeded my expectations. For learning how to develop real database applications using LINQ, there is simply nothing else out there.

If you would like to comment on this page, click on the Discuss button located on the top-right of each page. Feel free to edit any mistakes or ommissions you find. If you have an objection or find in-appropriate content then contact the administrator. This website is not affiliated with Microsoft®, all content and opinions are those of the specific author and some advice, solutions and article may contain un-intentional errors - please use care. Powered by ScrewTurn Wiki version 2.0.33. Some of the icons created by FamFamFam.