All posts by Julie

Finding the Entity Framewrok & Astoria documentation for VS2008 SP1

The SP1 Beta does not include updated documentation for Visual Studio 2008, but it is all online.

You can start here: http://vs2008sp1docs.msdn.microsoft.com/en-us/default.aspx

A direct link to EF documentation is: Entity Framework

The tools documentation is not contained within there. Instead it is here: Entity Data Model Tools

The Astoria documentation is here: ADO.NET Data Services Framework

To me the most helpful thing is to see where it lives in the hierarchy so here’s a pretty picture

T4 Templates for Entity Framework model-friendly stored procs

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.

To SPROC or not to SPROC

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.

Matthieu Mezil’s new English blog

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

Matthieu Mezil in French

Matthieu Mezil in English

Command Execution of directly called ImportFunctions (stored procs) in Entity Framework

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.

Responses to Danny Simmons "Why Entity Framework" post

I’m definitely interested in what people have to say about Danny’s post so I have subscribed to the Bloglines citations of it:

http://www.bloglines.com/search?q=bcite:blogs.msdn.com/dsimmons/archive/2008/05/17/why-use-the-entity-framework.aspx

RSS

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).

VB.NET Day in Waltham, MA: May 27th

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.