Language-Integrated Query (LINQ) is Microsoft's latest data-access technology
and is scheduled to be included in the upcoming Visual Studio 2008 (code-named
Orcas) release. I first discussed LINQ in my article "LINQ—The Missing
Piece of Database Development," January 2006, InstantDoc ID 48454, and Microsoft
is finally offering this functionality. Microsoft's goal with LINQ is
to provide developers with a unified and tightly bound database development
experience, which doesn't exist in today's development environments. LINQ is
the long-awaited wave of the future, and its benefits definitely outweigh its
drawbacks.
As every database developer knows, creating ADO.NET database applications requires
working with multiple data-access technologies. On the .NET side, developers
must use .NET languages such as C# or Visual Basic (VB) to write database applications
and then use the ADO.NET objects to connect to backend databases. ADO.NET doesn't
include any database-query or update capabilities. Instead, ADO.NET must send
T-SQL statements to the database. Often, application developers must hand-code
these statements. To do so, developers need to understand the nuances of the
language they're using, the ADO.NET middleware objects, T-SQL, and the database
schema. In this development model, nothing warns developers at the time of design
if something is wrong in the query.
LINQ will change this paradigm entirely. LINQ will extend the .NET framework
to incorporate native query constructs into the C# and VB languages, eliminating
the need to wrap ADO.NET around T-SQL. The new query operators that LINQ will
add to the C# and VB languages will enable them to perform database queries
and update operations without dropping back into the T-SQL language. LINQ will
also give developers design-time feedback about the queries they're building.
Once the application is built, Visual Studio can connect to the backend databases
to make sure that the query syntax elements (e.g., database table, object names)
are correct. These improvements will streamline the development process and
give developers feedback well before anyone runs the application.
Some are concerned about LINQ's
drawbacks. The biggest hurdle will be
learning a new database access methodology. This type of change doesn't come
easily—especially for shops with large code
bases. Another problem will be that DBAs
who diagnose LINQ-related performance
problems will have to deal with another
code layer. However, using LINQ isn't
really an all-or-nothing proposition. LINQ
is built on top of ADO.NET, and you can
easily add LINQ statements in conjunction
with existing ADO.NET code. For DBAs
looking at LINQ code, SQL Profiler won't
be that different from today's ADO.NET.
For more information about LINQ, go to http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx.
To get a feel for the new LINQ syntax, see "101 LINQ Samples" at http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx.
And for some handson experience, download the LINQ Community Technology Preview
from http://www.microsoft.com/downloads/details.aspx?familyid=1e902c21-340c-4d13-9f0470eb5e3dceea&displaylang=en
End of Article