Blog Home  Home Feed your aggregator (RSS 2.0)  
Joël Hébert | Opulent ASP - May, 2009
Enterprise ASP.NET
 
 Sunday, May 03, 2009

Yesterday I had the pleasure to present at the Ottawa Code Camp.I showcased something quite interesting and got alot of feedback on it.



In Entity Framework you can stronly type your linq to sql includes by adding Extension Methods. I found just methods as I was perusing the net one day.

Extension Method

Later on I discovered that the possiblitily to daisy chaine these strongly typed incudes could be done by daisy chaining lambda expressions. .This can be acheived with this Extension Method from the same author.

Extension Method for multiple includes

The lesson to retain is that the compilation is going to catch the erroneous fields if they are altered or missing , and not the user at run-time.

Here is the semantical variance:

NORTHWNDEntities ctx = new NORTHWNDEntities();

var Category_Products_EagerLoad = ctx.Categories.Include("Products");

//VS

var test = ctx.Categories.Include(c => c.Products);

Sunday, May 03, 2009 12:05:06 PM (GMT Standard Time, UTC+00:00)  #      Entity Framework  | 
Copyright © 2012 Opulent ASP Development Inc.. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.