Entity Framework 5: Controlling automatic query compilation

When working with LINQ to Entities, Entity Framework has to parse the expression tree from the LINQ query and convert it to SQL. It is possible to save the output of this using CompiledQuery, but this is something that you have to manually code. One of the new features coming in Entity Framework 5 (EF5)…

1

ASP.NET MVC & jQuery UI autocomplete

UPDATE: I’ve written a follow-up post that shows how to achieve this using Html.EditorFor here. If you get me started talking about ASP.NET MVC then it is quite possible that I’ll end up talking about Progressive Enhancement or Unobtrusive JavaScript. Aside from the usability and performance benefits that these techniques can bring, I find that…

11

ASP.NET MVC - Creating a DropDownList helper for enums

Do the types you work with in your ASP.NET MVC models ever have enums? Mine do from time to time and I’ve found myself needing to render a dropdown list to allow the user to select the enum value. For the purposes of this post, I will be working with a Person class and a…

29

Improving ObjectQuery<T>.Include – Updated

Having spent some time using the sample from my previous post on ObjectQuery.Include, I’ve encountered a bug! It turns out that the code generates the wrong include string for context.Customers.Include(c => c.Order.SubInclude(o=>o.OrderDetail)) The fix for this is a small change to the BuildString method to recurse up the MemberExpression if necessary. The updated code is…

7

DataServiceQuery<T>.Expand

ADO.Net Data Services allows you to expose your LINQ To Entities model (or LINQ To SQL model, or even your custom IQueryable model) via a RESTful API with minimal coding. For example, if you’re working with the Northwind database you can use the URL http://server/Service.svc/Customers(‘ALFKI’)/Orders to retrieve the orders for customer ALFKI. This simplicity makes…

7

Improving ObjectQuery<T>.Include

** UPDATE: There’s a bug in the code below – see this post for the update! One of the great features of LINQ To SQL and LINQ To Entities is that the queries you write are checked by the compiler, which eliminates typing errors in your query. Unfortunately, the ObjectQuery<T>.Include function (which is used to…

14