.NET Framework 3.5 SP1: LINQ perf improvements (LINQ to Objects and LINQ to SQL)

There are three perf improvements in the just released SP1. As always, I will let you run your own microbenchmarks or more meaningful app-level benchmarks. LINQ to Objects:   Specialized enumerable: The new implementation recognizes queries that apply Where and/or Select to arrays or List<T>s and fold pipelines of multiple enumerable objects into single specialized…


Templated code gen for LINQ to SQL

This is going to be a brief one. If you are using LINQ to SQL, you should check out Damien’s new templated code generator sample. One of our regrets from LINQ to SQL V1 days was not providing an easy way to tailor the code-gen. This is one step in that direction.  Another major step…


Relational-Object-XML-Object with LINQ to SQL & LINQ to XML

This is old story and I have used parts of it over the last three years to show how LINQ lets you navigate from relational (R) to object (O) or object to XML (X) etc. But for a forthcoming demo, I had to write some quick code today and it looked like it might be worth…


LINQ to SQL Tips 9: Understanding DataContext’s internal caching

Back to the “tips” series after a little break … One common question I get is about caching of data in LINQ to SQL. It means a lot of different things so let’s start with the following baseline: LINQ to SQL was designed to get you objects from the database and to submit the changes…


An account of Bill Gates’ farewell

An unusual subject for this blog that has been mostly about components I have worked on. But the event yesterday was memorable and worth sharing. The event has been covered widely so I won’t even try to broadly summarize. Insted I will list what I found interesting. I was lucky enough (one of 2k lottery…


Design of LINQ to SQL – What was I thinking or was I?

A little break from my “LINQ to SQL tips” series of posts. A recent vote of no confidence on a related component orchestrated by community activists reminded me of many questions I have fielded and how the design team approached the design of LINQ to SQL (and also core LINQ APIs and C# language changes…


LINQ to SQL Tips 7: Minimal update when you don’t want optimistic concurrency check

The common guidance for updates is to keep the original values in view state so that you can recreate the object in its original state, Attach() it and then set the values that the user has modified. This works well for the most part. But at times, a user is allowed to to set only…


LINQ to SQL Tips 6: How to refresh given DataContext won’t stomp on your objects

The DataContext is a rather careful beast. Once an object is retrieved, the DataContext will not stomp on it if a query returns the same object again. This is intentional. Imagine the chaos if you modified some of the retrieved objects or even read the values and made some decision based on that and then…


LINQ to SQL Tips 5: Using stored procs that return multiple results

Often I get the following questions about stored procs in LINQ to SQL: I have sproc that returns multiple results. How can I use it in LINQ to SQL? Can I use a sproc that returns results of different shapes; e.g. Customers and Orders? I drag-dropped a sproc returning multiple results on the designer surface….