Daily Archives: May 22, 2008

Hey lookatdat! You can copy and paste scalar properties in the designer

I was getting ready to suggest this feature because it’s a pain to “move” properties if you are deriving types or doing entity splitting.

I actually use the method of going into the EDMX file and copying the properties around in there so that I don’t have to worry about the attributes and facets. Especially when I have a lot of properties to move.

Just out of curiosity I right clicked on an scalar property in the designer and saw Copy on the context menu, so I clicked it. Then tried pasting it into another entity and VOILA! Not just copy and paste; but cut, copy and paste

The funny part is that may have existed in the previous bits but I never noticed it before.

I can go shorten my book by a whole page now!

(I also want you to know that I was a good girl and removed “Holy Crap!” from the blog title and replace it with exclamation that is there now.)

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.