Wednesday, May 27, 2009

Introducing LINQ

Orcas significantly improves the way developers handle data.
Traditionally developers have manipulated data differently depending on where the data resides and how the user connects to it.

With the introduction of Language Integrated Query developers can now deal with data using a consistent programmatic approach and perform data access with new data design surfaces.

LINQ aimes to reduce the complexity for developers and help boost their productivity through a set of extensions to the C# and Visual Basic programming languages as well as the Microsoft .NET Framework, which provides integrated querying for objects, databases, and XML data.

Using LINQ, developers will be able to write queries natively in C# or Visual Basic without having to use specialized languages, such as Structured Query Language (SQL) and Xpath.

With Visual Studio “Orcas”, you can work with data in the way that you want. You can create entire collections of objects from a database backend if you like. You can interact with data as rows or columns – whatever makes sense to your application.
Language Integrated Query or “LINQ” will dramatically change the way we work with and program against data. By creating a common querying language in LINQ, we’ve freed you, the developer to focus on things that matter most to you. LINQ will provide you the ease of use you’ve come to expect with Visual Studio offering both IntelliSense and Autocompletion right in the IDE.

Language Integrated Query provides native querying syntax in C# and VB.Net. This frees the developer from having to master independent data programmability technologies (e.g. Xpath, Xquery, T/SQL) and instead offers the developer a consistent way to query data.

The best part is that the LINQ code you write is consistent whether your data store is a SQL Server, contained in a ADO.NET DataSet, an XML document, an EDM you create or even objects you create in memory.

With Orcas, we have taken a more general approach and are adding general purpose query facilities to the .NET Framework that apply to all sources of information, not just relational or XML data.

This facility is called .NET Language Integrated Query (LINQ).
With Orcas and ADO.NET 3.5, LINQ is an inherent part of the C# and VB.Net languages offering both IntelliSense and Autocompletion.

LINQ provides developers with a consistent query language which they in turn may use on various types of data. Be it Objects, XML, Datasets, SQL Server (or other databases with ADO.NET providers) and Entities. Any data that may be placed into a .NET collection of type IEnumerable can be queried by LINQ.

If you’ve written T/SQL in the past then LINQ will offer you familiar constructs for projections, restrictions, sorting and grouping such as Select, Where, GroupBy, and OrderBy.

You can also adapt the query operators to your liking by using extension methods which can override their default behavior.

No comments: