30 July 2010

Introducing the Model Comparer for Entity Framework v4

This is a brief intro to the just-released Model Comparer for Entity Framework. The model comparer is part of the Huagati DBML/EDMX Tools add-in for VS2010, and was added in version 1.91 released on 29 July 2010.

 

The problem

The Entity Framework designer in Visual Studio 2010 has a lot of improvements over earlier versions. Like its' predecessor in VS2008 it has the ability to update the model from the database, but like its predecessor it gives the user a rather limited choice over what to update.

 

Developers often need a more fine-grained control over the diffs and updates; there may be hand-tweaked parts of the EF model that they don't want to change and there may be database changes that should not be propagated over to the model.

 

The model comparer

The model comparer is an attempt to give developers more control over the EF4 designer in Visual Studio 2010 in terms of handling db-model differences and intra-model-differences.


The add-in doesn't replace the EF designer and doesn't remove anything that is part of Visual Studio. It does however give a more detailed overview over differences between each of the layers; database, storage model, and conceptual model. The differences are displayed in three treeviews, and there are a number options for bringing individual or all differences across as well as for ignoring differences.

 

The Huagati Model Comparer

Whenever a model is updated using the model comparer, only the relevant portions of the SSDL, MSL and CSDL are updated. Entities with no changes are left untouched along with any customizations that may have been made to them. This is unlike the VS built in "update model" wizard that often overwrite manual changes to the model when only a specific change should have been brought across.

 

I have made a short intro video showing the model comparer in action in VS2010 against the Microsoft AdventureWorks database. Enjoy!

 

8 comments:

  1. Is there any free alternative?

    ReplyDelete
  2. Hi!

    I use EFv4 and when I update my model, EF regenerates CSDL and SSDL, overriding manual changes that i've done it.

    Could your tool help me to avoid this improve?

    Thanks.

    ReplyDelete
  3. @Pelé - yes, that is one of the basic concepts in it; it only updates the portion of the CSDL and SSDL that you choose to update. Everything else is left intact, so that customizations don't get overwritten etc.

    ReplyDelete
  4. Oh thanks KristoferA, it goes magnific with your tool. If the boss had bought a license could be great :P

    ReplyDelete
  5. Hi Kristofer.

    I'm having an issue with your plugin, when I add a table, it paints at the middle so far in the right of the model,

    making it me to drag it to the center with the rest of entities or daoing a layout that undone all manually layout.

    How can I resolve this? Because layout that provides entity framework is so ugly :P

    ReplyDelete
  6. The problem I am having with EF is that we have alot of tables divided up into three different schemas. We would like to have a prefix on the entitie names in Ef that show what schema they are from. Can your tool still work if the entities were manually changed to use a slighly changed name?

    ---Dave

    ReplyDelete
  7. @Dave - yes, it uses the model's mapping data to match up entities so it works even if you have renamed entity classes or properties in the conceptual model.

    ReplyDelete