by Soumitra Sengupta
I am writing from PDC 2005, at Los Angeles. Anders Hejlsberg just showed a demonstration of the Language Integrated Query Framework (codename Project LINQ) at Jim Allchin’s keynote address. If you are not at PDC and want to see what this is all about, please visit http://msdn.microsoft.com/netframework/future/linq/. The site will be up and running in the next few days. If you program against SQL Server and XML it will be worth your while. It is going to change the way you will query, transform and manipulate data from relational databases, XML and in-memory objects. The result I believe is dramatic increase in productivity.
This is as much hyperbole as I am going to use here. So let us get to the facts. There are millions of developers who program with in-memory objects, query and fetch data from relational databases and now want to query and transform XML. Till now their option was to learn a general purpose programming language like C#, VB, C++, learn SQL to write queries against SQL Server and XSLT, XPath, SAX, DOM, XmlReader and possibly XQuery to program against XML. I do not know about you, but it is quite a chore for me as at least in the realm of XML, because all use different data models. So we started asking the question – how can we let developers do this work more efficiently by using C#/VB and Visual Studio. The answer we came up with is Project LINQ. The project is led by Anders Hejlsberg, Distinguished Engineer here at Microsoft and spans several product units and divisions at Microsoft, including the product unit I work for.
Project LINQ is the Language Integrated Query framework is a set of language extensions to C# and VB and a unified programming model that extends the .NET Framework to offer integrated querying for objects, databases and XML.
DLinq: for relational data access
XLinq: for XML data accessL
I will only talk about XLinq from a very high level. XLinq has two facets.
a. One facet is an in-memory cache that is faster, lighter and I believe easier and more intuitive to use than XmlDocument (W3C DOM). Let us face it, DOM has been around for a while now and does not take advantage of modern language features like generics. I think we can all agree that reading a document into XmlDocument, making changes to it and save it back is not for the faint of heart and the code written is not very readable. The in-memory model is simple and elegant and makes good use of the new features in the CLR. Dave Remy who is driving XLinq from our team will be writing about it in more detail so I will let him explain the technical details of XLinq in-memory model.
b. The second facet is language integrated query support. We add familiar XPath axes (like Descendants, Child, Parent) to the query operators in the LINQ framework, functional construction of XML to make it composable with the query operators and a host of other features to provide a rich programming, query and transformation experience. Whether you program in C# or VB, you get all the benefits of this model plus compile time checks, intellisense support and auto completion of statements in Visual Studio. On top of that we add support in VB for XML literals and take advantage of late binding to simplify the developer’s job even further.
I really want to stress one thing – this does not mean Microsoft is walking away from supporting XPath, XSLT, DOM and SAX. On the contrary we will make improvements to our MSXML and System.Xml components and add tools support to improve performance and ease of use for our developers. If you have invested in these technologies, you can bet that you will be able to leverage your investments over multiple releases of Visual Studio and Windows. There are scenarios like Docbook, localization and personalization where it makes sense to learn a language like XSLT. Our customers who depend on XSLT for these scenarios will continue to get value from the Microsoft platform. But for millions of developers who live and breathe C# or VB and do not want to go through the learning curve of DOM, XSLT and XPath, XLinq will provide a very productive alternative. XLinq will sharply lower their learning curve and increase their productivity.
How many of you routinely create a connection to a database, query the database using SQL, get a DataReader back, construct XML over the reader and send it over the wire? Once you play with the bits you will realize how easy it will be to do tasks like this using the technologies in Project LINQ.
So you ask, when is this going to be available? The bits were distributed at PDC and is also available for download, including whitepapers and sample code from http://msdn.microsoft.com/netframework/future/linq/ . I strongly encourage you to play with the bits and give us feedback. Your feedback is a critical part of shipping this technology in future releases of Visual Studio. If you like it, tell us what you like about it. If you do not like it, again tell us what you do not like about There will be Project LINQ related forums setup at http://forums.microsoft.com/ for you to provide feedback. The Project LINQ team is eagerly awaiting your feedback.
Finally stay tuned to the XML Team Blog if you want to get more technical details on XLinq in both C# and VB in the coming days.
If you are at PDC, do look us up. I look forward to meeting with you and sharing our thoughts on this exciting project. If you are not, provide your feedback in the comments section.