Check out Ryan Hauert’s blog!
Only two EF posts so far, but based on his busy postings in the forums, I imagine there will be more…
Check out Ryan Hauert’s blog!
Only two EF posts so far, but based on his busy postings in the forums, I imagine there will be more…
While I was in the middle of a flurry of conference prep and travel in April, I got an email pointing me to an interesting blog post by Dave DeWinter who is using T4 Templates to generate entity friendly CUD stored procedures. Why “entity friendly”? Because of a number of rules enforced by the model such as:
If you are using Stored Procs to do function mapping to an entity, you must use all three operations: Insert, Update and Delete.
if you have an association, the foreign key (aka the ID through the navigation property, e.g. Customer.Address.AddressID) must be used in all three (Insert/Update and Delete) stored procedures
If you do function mapping for a single entity in an inheritance hierarchy, you must have mappings for all of the entities except for abstract base types in the hierarchy.
I have been fighting the concept of modifying the database to enable the model (yeah – call me data-centric yet again and call em “she who worries about annoying the DBA” even though all of the DBAs I’ve ever met are pretty easy going)) but something has to give somewhere.
Dave and Ryan Hauert (who has been very active in answering forum questions for EF as of late!) are very pleased with the results of their templates.
Interestingly, at DevConnections, Danny Simmons was talking about providing functionality like this in a future version of Entity Framework.
So I’m going to go check this out, and play with it a little bit and see how it goes.
Can somebody tell me why CNN thinks this is a good idea? (Besides the profit motive…)

I’ve been spending a lot of time futzing with stored procedures in Entity Framework and losing sight of the fact that one of EF’s core features is its ability to do query processing – and that is something it does very very well.
The Stored Proc support is obviously critical for many and while it’s there, some scenarios are pretty easy to pull off, while many others are possible but not so easy to implement and that can get frustrating.
What I’m trying to do is just truly see which things are easily pulled off in the designer (and discovering more than I realized), which are doable and which might take a hack or two to get around.
I think that in my case I was focused on the trees and forgot the the forest.
Thanks to the person who helped remind me of that.
Scott’s a pal, promoting my book and my workshop on twitter! 
Matthieu Mezil is a Parisian who really digs .NET and the Entity Framework. He writes a lot about it in his native tongue (that would be French ;-)) in his blog.
Since my French, which I studied for 4 years in high school and college (which was a long, long time ago) is pretty rusty, I use google’s translation to get a gist of what he is saying in his blog.
But now that Matthieu is an MVP, he has started a mirror blog in English on the msmvps.com/blogs site.
So to recap
I hadn’t noticed this before.
If you have a stored procedure that is mapped to an entity such as "GetCustomersSince" which returns Customer entities, the command is executed when you create the query, not, like with normal queries, when the data is first needed.
In case that sentence was too convoluted…
Here is a LINQ to Entities query (the same is true for LINQ to anything and also for Object Services (context.CreateQuery))
Dim query= From c In context.Customers Select c
For Each cust in Query <– command is executed here
‘do something
End For
But when calling a function import:
dim custs= From c in context.GetCustomersSince(New Date("2008","01","01")) <–command is executed here
For Each cust in custs
‘do something
End For
Looking at the code gen for the function I can see that ObjectContext.ExecuteFunction is called.
I’m definitely interested in what people have to say about Danny’s post so I have subscribed to the Bloglines citations of it:
Don’t forget the comment thread in Danny’s post as well.
Not surprisingly, the folks who have already made it clear that EF is way too data-centric for them are up in arms and there are some very interesting discussions in their blogs (as well as the comment threads).
I’m not sure if I would compare the investment I am making in understanding how EF works and writing a whole book to share what I’ve learned to being brainwashed by a "shiny brochure on your desk". Nor do I feel like a "cheerleader" or "parrot". But… whatever… (lame response? Yep! But it’s all I have time (or patience) for).
Michale de la Maza follows up his popular C# day events with a VB.NET day at the Microsoft office on Tuesday May 27th.
Join us for a relaxed, no cost introduction to VB.NET programming. By engaging in participatory activities, you will learn some of the most common and powerful features of the VB.NET language. This day is not lecture-based. There will be fewer than 60 minutes of lecture material — almost all of the time will be spent on participant-guided activities. Everyone who attends will learn what interests them at their own pace in a relaxed, tension-free environment with an experienced VB.NET developer and trainer available to answer questions.
RSVPs are required and details are here.
The online registration system for Microsoft events is currently broken (or just acting really flakey).
If you are trying to register for Thursday’s free, full-day, Bob & Chris & Jim Roadshow , try the online registration first here:
http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032378634&culture=en-US
If that doesn’t work, you can register by phone
Call the event system directly (877.673.8368) and use the event ID 1032378634.
For more information and details about the event, see Chris’ blog post here:
http://blogs.msdn.com/cbowen/archive/2008/05/02/the-roadshow-rides-again-may-june-edition.aspx
If you are trying to register for a different one of these Roadshow events, just get the EVentID from Chris’ blog.
If you are trying to register for other Microsoft events the phone # should be the same, but you’ll need to know the EventID of the event you are trying to register for.