LINQ – Is It the New SQL?
I have been using LINQ for Objects a lot recently. It allows me to leverage my set based skills when processing Dot Net IEnumerable objects. This seems to be something I have to do a lot lately.
About the same time, I started looking at NHibernate again. I find it interesting that LINQ looks an awful lot like the NHibernate query language. You specify the data source first, then the select statement, then a where clause, etc. So, what’s the big deal? LINQ works with sets; not just database sets, but any set accessible in Dot Net.
The thing I like about LINQ is that it has a consistent look and feel when working with sets, regardless of the source. There are some techniques and optimizations that can be done when using LINQ to SQL. But the basic vanilla LINQ syntax gets you started.
I don’t think LINQ would replace SQL completely because SQL contains syntax for both schema creation and querying. It wouldn’t make sense to modify LINQ for Schema creation, or would it?
I spend a lot of time helping developers with SQL code. I love it when developers are writing SQL. It helps them to better understand what is going on in all layers of the systems they manage.
Now I am wondering, do they really need to know SQL? Why not let them use a language such as LINQ with a common syntax that works in both worlds. Either that, or perhaps MS could write a version of TSQL that works with collections in Dot Net? I think the fact that LINQ is more object oriented makes it a better option.
So, the fact that we can use LINQ to SQL today when accessing SQL Server, we have the capability of running LINQ queries against our database. The downside is that those queries have to be translated into TSQL through a device driver for submitting the query, and the resulting TDS stream has to be translated into LINQ accessible collections when returning the results. Wouldn’t it be nice if SQL Server simply understood LINQ as natively as it does TSQL?
Well, there goes my brain for a while. Feel free to tell me how foolish this concept is. Send your comments or even your ideas to btaylor@sswug.org.
Cheers,
Ben
$$SWYNK$$
Featured Article(s)
Information Architecture and Governance – What’s New for SharePoint 2010 (Part 2)
While there are three interdependent segments defined by Microsoft in their Governance Model: IT services, information management and application management, we will look closely in this part of the post at what is necessary for successful information architecture.
Featured White Paper(s)
Query Tuning Strategies for Microsoft SQL Server
Written by Quest Software
When you’re looking for a reliable tool to diagnose … (read more)