Project Description
Extension for Visual Studio 2010 that makes the Entity Framework V4 designer work on models that are stored in separate files, rather than in a single EDMX file.


This project defines an extension for Visual Studio 2010 that makes the Entity Framework V4 designer work on models that are stored in separate files, rather than in one single EDMX file. The purpose for this extension is to improve version management on EDMX files. An EDMX file holds 4 different models: a storage, a conceptual, a mapping, and a layout model. When putting an EDMX file under version management it is rather difficult the merge changes or to understand how to resolve merge conflicts. This is partly because it is not always easy to distinguish the different models, and partly because the layout of the model will often change, which will cause irritating merge conflicts.

This extensions helps in the following ways:
  • The three models that define an entity model (i.e., the storage, conceptual, and mapping models) are stored in separate files, making it easier to interpret merge conflicts
  • The layout model is saved in a file called <m>.Designer.diagrams.

When opening an EDMX file <m>.edmx in the designer, the extension dynamically constructs the EDMX model by reading the conceptual, storage, and mapping models from the files <m>.ssdl, <m>.csdl, and <m>,msl, respectively. The layout of your diagrams is obtained from the file <m>.Designer.diagrams. When saving a model in the designer, the three models and the layout of your diagrams are removed from the EDMX model and stored in the separate files.

With this extension only the separate model files will change, the EDMX file will always be an an empty model (i.e., it contains the initial model that was generated when you created a new model in the designer).

Installation
  • Download the file MultiFileEDMX-20100816.vsix from the 'Downloads' page
  • Run MultiFileEDMX-20100816.vsix
  • (Re-) start Vs 2010

Installation from source
  • Checkout the source code
  • Open the project in VS 2010
  • Build the project
  • Install the file `MultiFileEDMX.vsix' in the bin/Debug directoy in VS 2010 by double clicking it.

If you (re)start VS 2010, you can check under 'tools/Extension Manager...' that the extension 'MultiFileEDMX' is installed. If you create a new EDMX file (or edit an existing one) you will notice that in addition to the EDMX file, also separate ssdl, csdl, msl, and diagrams files are generated.

Working with multi-file EDMX files
EF requires run-time access tot the entity data models, which means that it must be able to load the three edm files at run-time. To accomplish this you need to perform the following steps:
  • In solution explorer click on the edmx file and change its build action in the properties window from "EntityDeploy" to "None".
  • Include the three edm files in your project.
  • For each of them, select the file in the solution explorer and set its build action in the properties window to "Embedded Resource".
  • In the App.Config file, change the locations of the edm files in the metadata tag of your connection to include the default namespace of your project. E.g., if it contained a location res://*/Model1.csdl change it to res://*/<your default namespace name>.Model1.csdl.

Last edited Apr 22, 2011 at 7:04 AM by MdeJ, version 8