Triggered by a blog post of Scott Hanselman I was wondering if I could create a generic extension method to asynchronously retrieve objects from a DataContext. And well I could. I ended up with two classes. It was very easy to get this result and you could of course add some more methods that simply return a single object instead of an IEnumerable
. The code is attached so you can try it yourself.
...
An important action with every LinqToSql query is to transform your lambda’s into T-SQL. In simple queries this can take half of the time. By compiling the query you can cache the result of this transformation which saves a lot of processing time on each succeeding query....