Upcoming courses:

  • Aarhus, Denmark, March 5 - 9, 2012
  • New York City, USA, March 26 - 30, 2012
Read more on our website

About me

Brian Holmgård Kristensen

Hi, I'm Brian. I'm a Danish guy primarily working with ASP.NET e-commerce solutions using Microsoft Commerce Server.

I'm co-founder and core-member of Aarhus .NET Usergroup (ANUG), which is a offline community for .NET developers in Denmark.

You can visit my View Brian Holmgård Kristensen's profile on LinkedIn or follow me on Twitter @brianh_dk. Also please feel free to contact me via e-mail Send me an e-mail.


On this page

The .NET Language Integrated Query Framework



The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0

Send mail to the author(s) E-mail

Total Posts: 36
This Year: 0
This Month: 0
This Week: 0
Comments: 10

Sign In

Follow me on Twitter @brianh_dk
 Wednesday, 07 November 2007

This session by Luca Bolognese, LINQ Lead Program Manager from Microsoft was absolutely great! Luca set the atmosphere even before the session began by playing some “Santana - Maria Maria” music from his portable music player out on the main speakers. Maybe it was in favor of the girls sitting on the front row, it might have been, however it was a nice prestart on the session and made Luca look pretty confident.

Data != Objects

He started out by telling the story of how wonderful a life we as developers have, until we reach a certain point in our code where we start to write code to access data from somewhere. Up until that point we get nice compile time errors when writing bad syntax or accessing non-existent properties, methods or whatever. But when we start writing our data access code we no more get our lovely compile time errors for instance when writing a SQL query. He compared this to driving your Ferrari 300 km/hour down the road feeling all great with wind blowing in your hair and all that, and suddenly you crash into a wall! Pretty excessive analogy though a funny one. He followed up stating that he wants to change this experience. He wants to introduce as many compile time errors as possible because this is much better than getting the errors at runtime. He went on saying something like LINQ will change the way you write code and stated out that even though this sounded exactly like a marketing slogan, it was really a true statement.

LINQ is a First Class Citizen in .NET

Luca Bolognese continued showing an architectural overview of LINQ where he provided introduction to the common LINQ To <Something> providers, including LINQ To Objects, LINQ to DataSets, LINQ To SQL, LINQ To Entities and LINQ To XML. And on top of these providers where the actual CLR compliant languages such as C# 3.0 and VB.NET 9 that both have LINQ implemented directly in their syntaxes. He told us that LINQ To SQL is the provider to use if you want the fastest possible way of getting access to data via SQL Server – and by fastest he did not mean performance-wise, but by doing less work as possible. LINQ To Entities is more suitable for enterprise solutions having a complex mapping framework and also offering a far more abstract way of looking at the data store. I will be attending specific sessions on LINQ To Entities later on, so more on this topic as I come to it.

Luca fired up his Visual Studio 2008 in order to demo features of LINQ. His mission was to initially have some C# 2.0 complaint code querying Customer data from an in-memory collection, and then convert this code into C# 3.0 utilizing new language features and LINQ. Luca used his own prewritten code-snippets to generate most of the code in his demo, which I think was very good, thereby adding more time to the actual content rather than use time on writing all the code on the fly. Step by step Luca converted this C# 2.0-ish code to C# 3.0, each time with a new language feature, covering topics like Auto-Implemented Properties, Object and Collection Initializers, Local Variable Type Inference, Anonymous Types and Lambda Expressions. I won’t go into details about these topics, as I will be attending a session tomorrow that should cover all this, but it was really convincing and as he demoed along you could really see the benefit on having these new language features making your code much more readable.

After converting the code to C# 3.0, Luca changed the data source of the Customers from an in-memory collection to be loaded from a SQL Server database using LINQ To SQL. He explained the difference between how the compiler sees queries being an instance of IEnumerable<T>, as it is with LINQ To Objects, to see queries being an instance of IQueryable<T>. When the query is an instance of IEnumerable<T> the compiler will do all the operations supported by LINQ in memory, e.g. the ordering and/or grouping of the collection. But when the compiler sees an query that is an instance of IQueryable<T> then the compiles creates an expression tree that is passed along to whatever Query Processor that is implemented in the concrete LINQ Provider, e.g. the Query Processor in LINQ To SQL which is responsible of generating the T-SQL code.

Luca moved on with his presentation showing us some example of LINQ To XML and showed us how to combine accessing data from the database and generating XML out of that, which very convincing showed the concept of getting data from wherever and place it in whatever using LINQ.

Last Luca also showed a new feature of VB.NET 9 of having fully support of XML directly inside the language which was really impressing and seemed to be a very powerful feature of VB.NET 9.

It was really nice to attend a session where the speaker adds lots of humor to the content and also seems extremely enthusiastic about his work. The best session so far.

IMG_1402 IMG_1401

Posted on Wednesday, 07 November 2007 08:14:10 (Romance Standard Time, UTC+01:00)
# | Comments [1]