A lot of people have doubts about whether to use LINQ to SQL for real-world applications, especially since Microsoft has encouraged in favor of the new version of the Entity Framework slated for release with .NET 4.0 and Visual Studio 2010.
Recently, I have read the book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution (Wrox Programmer to Programmer) ~ Vincent Varallo (Author)
This book faithfully follows the very popular Wrox “Problem – Design – Solution” format, evolving chapter by chapter while analyzing business requirements, examining various design scenarios, and implementing a beginning-to-end solution in a reusable framework. The book uses LINQ to SQL for data access. It covers a lot of important material.
The bottom line is that LINQ to SQL is a perfectly viable alternative when you can guarantee that the database will be Microsoft SQL Server (2000 or later). It has support for POCO (persistence ignorance), stored procedures, lazy loading, and concurrency management, and it works well with SOA (n-tier) architectures.
Do I use LINQ to SQL in new projects?
I Do
Microsoft is not going to stop including LINQ to SQL in the .NET framework until they are convinced EF is a good migration target for all the current LINQ to SQL users. That day has not arrived. Therefore, I believe I have plenty of time to be productive with LINQ to SQL before I must make a change.
The question is, “Who is adding new features to LINQ to SQL?” The answer is a product called Plinqo, created by the makers of the code-generation tool, Code Smith. The purpose of Plinqo is to generate LINQ to SQL entities that replace those created when you add a dbml file to a Visual Studio project. In fact, Plinqo will generate the dbml file for you, placing each entity in a separate .cs file under a common folder. Actually, Plinqo creates two files: one for the code-generated entity, and another for your own custom metadata that will not be overwritten by the code-generator (for example, attributes that can drive a dynamic data web site).
While Plinqo generates code that is better organized and easier to read, its power lies in the extensions it provides, such as manager and query classes, a build-in rules engine, audit trail, caching, cloning and detaching entities. It also de-normalizes many-to-many relationships and takes advantage of improvements to the DataContract attributes for .NET 3.5 SP1 (avoiding cyclic references and the need for the “unidirectional” serialization option). In addition, Plinqo will create enums instead of entities for tables with lookup values.
But wait, there’s more! Plinqo has actually enabled batch updates and deletes, eliminating possible round-trips when calling SubmitChanges to process updated entities. Wow, now that is something I had been hoping Microsoft would give us in the next version. But thanks to Plinqo, I won’t have to hold my breath waiting for Microsoft, which has stopped adding new features to LINQ to SQL. Lastly, Plinqo also enables batch queries and the ability to process multiple result sets from stored procedures.
And to top it off, Plinqo has templates to create an ADO.NET Data Services layer that exposes entities via a REST-ful web service. There’s even a quick start template that will create both the service and a dynamic data web client in a matter of seconds.
So before you decide to give up on LINQ to SQL, check out Plinqo to get a fresh option for using LINQ to SQL in real-world applications. They’re even offering a free CodeSmith license if you mention Plinqo in a blog or tweet.
Popularity: 2% [?]
January 16th, 2010
admin
Posted in
Tags:
Great review!! Thanks! PLINQO 4.0 was just released and includes even more awesome features!
I’ve went ahead and saved as a favorite http://osman.it/c/plinqo-by-codesmith at Digg.com so my pals can easily see this as well. I only used PLINQO by CodeSmith | Mohammed Osman Blog for the entry headline in my Digg.com bookmark, since I figured if it is good enough for you to name your blog post that, the chances are you would like to find it bookmarked the same manner.