Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

December 20, 2005 12:00 AM

LINQ—The Missing Piece of Database Development

SQL Server Pro
InstantDoc ID #48454
Rating: (2)

Microsoft's new Language Integrated Query (LINQ) technology lets programmers access database and XML data sources by using query extensions that Microsoft has added to the .NET Framework. LINQ addresses one of the biggest disconnects that exists in the current database development model.

In the current scenario, database developers use an object-oriented (OO) language such as C# or Visual Basic .NET (VB.NET) to develop the client application and business objects that exist in the data tier, and ADO.NET is the data access middleware that connects the application with the database. However,when the ADO.NET database code at the core of these programs needs to access the database, the developer must step out of the Visual Studio (VS) OO development methodology and construct a SQL query that's sent to the server.The compiler can't help developers ensure that they've used the right database tables or columns. It can't even check whether the query syntax is correctly constructed because the query isn't actually executed until the application is run.

The new LINQ technology addresses this problem by implementing an object-to-database mapping and providing a set of operators that enable the developer to create database queries directly in .NET code.The SQL-like operators support data retrieval as well as data insert, update, and delete operations—for instance, LINQ provides Select, Where, and OrderBy operators. In this initial release, the Select operator must appear at the end of the clause in C# programs, but in VB programs, Select appears at the beginning as you would expect.

To facilitate the process of database-to-object mapping,the early LINQ beta includes a tool that can generate database tables and classes based on objects in a target database. LINQ doesn't create a sophisticated mapping of one or more relational tables to business objects, rather, it creates a simple one-to-one mapping of relational tables to program objects. It's important to realize that although LINQ enables a new database development model, it's not a replacement for ADO.NET. In fact, LINQ uses ADO.NET, and an application can make use of both LINQ and ADO.NET. Although LINQ provides an OO face to the database, as you might guess, at its core, LINQ is still issuing SQL queries to the database server.

Although LINQ is positioned to create big changes in the future of database development, the current version is still in its infancy. Like the ADO.NET data providers, LINQ providers use an open architecture that enables other database vendors to create providers that work with the LINQ standard. Right now, however, LINQ works only with SQL Server, it doesn't work with Oracle or IBM DB2. Likewise, the initial release runs only on the client. However, the next logical step for LINQ would be to run on the server side with the Common Language Runtime (CLR).

For database developers, LINQ is quite possibly the biggest paradigm change since the advent of ODBC. LINQ eliminates the application-database disconnect and enables full OO database access.You can find more information about the LINQ project at http://msdn.microsoft.com/netframework/future/linq/default.aspx

Michael Otey (mikeo@teca.com), technical director for SQL Server Magazine, is president of TECA, a software-development and consulting company in Portland, Oregon, and coauthor of ADO.NET: The Complete Reference (Osborne/McGraw-Hill).

Related Content:

ARTICLE TOOLS

Comments
  • Don
    6 years ago
    Feb 12, 2006

    Um, please do not confuse LINQ with DLINQ, as they are separate things. My whole rant is up on my blog, http://donxml.com/allthingstechie/archive/2006/02/06/2522.aspx but here is the jist of it:

    LINQ is defined as "The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities."

    LINQ, by itself, has nothing to do with database development technology, but with integrated language query. The query extensions are over any .NET array or collection, not databases. The DLINQ component of the LINQ Project, provides a run-time infrastructure for managing relational data as objects without giving up the ability to query. XLINQ does the same thing, but for XML.

  • Ulises
    6 years ago
    Feb 08, 2006

    Another ORM tool?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.