InvocationExpression and LINQ to Entities

I talked a little bit about patterns using InvocationExpression in a previous post (you might want to review the post for some context). It turns out my advice wasn’t that easy to implement… Fortunately, the EFExtensions  helper library now includes an ExpandInvocations method that implements the same functionality (and a little bit more). I’ll return…


Stored Procedures and First-Class Relationships in the Entity Framework

A user of the EFExtensions library asked me how to retrieve a set of ‘categories’ and their related ‘products’ through a single stored procedure call. I made some changes to the sample application to illustrate this pattern, but I thought I should also spend some time explaining how it works. The full explanation takes a…


EFExtensions update

The EFExtensions helper library has a few updates:   –          CreateCommand now respects the CommandTimeout property on ObjectContext. A user of the library reported this bug to me a while ago, and I’m finally getting around to fixing it. –          One tricky scenario involves multiple stored procedure result sets that need to be combined to…


Using LINQ Expressions to Generate Dynamic Methods II

A beta of Visual Studio 2008 SP1 was released on Monday and the ADO.NET Entity Framework (EF) is now in the box! You can download and install the Beta here. The EF Extensions library has been updated to work with the beta and includes several public and internal changes. Source code is available at….


LINQ to Entities: Combining Predicates

Someone asked a great question on the ADO.NET Entity Framework forums yesterday: how do I compose predicates in LINQ to Entities? I’ll give three answers to the question. Answer 1: Chaining query operators Basically, you have some query and you have some predicates you want to apply to that query (“the car is red”, “the…


Using LINQ Expressions to Generate Dynamic Methods

This week at DevConnections in Orlando, I gave a “deep-dive” talk on LINQ. I wanted to give people a feel for what’s possible with the new language features and core APIs in .NET 3.5. I spent most of the talk discussing a single example: take an ADO.NET 2.0 code sample and simplify. Instead of using an existing library like LINQ to…


ADO.Entity Framework: Stored Procedure Customization

The ADO.NET Entity Framework (EF) allows you to map stored procedures to functions that return typed results in the conceptual model. However, when stored procedures results don’t match the patterns supported by the EF, reading and tracking results is quite difficult. Fortunately, it is possible to run arbitrary stored procedures and Transact-SQL commands through the ObjectContext. This post…