Ok, now, here’s the sample database:

Database Schema

Schema of the Database

Simple, eh. Check the source code included. In there I got two projects in one solution, EdmxMerge and MergedLib. EdmxMerge is supposed to be the basic application and MergedLib is supposed to be the extra part. For the sake of simplicity, I don’t use any modular/add-on/plug-ins technique in this solution, I simply add MergedLib as a reference for EdmxMerge. In reality, EdmxMerge should have some mechanism to load MergedLib or other extra parts separately.

In EdmxMerge, I put in the basic part (BasicModel.edmx):

Basic Entity Models

BasicModel.edmx

And in MergedLib, the extra part (MergedModel.edmx):

Extra Entity Model

MergedModel.edmx

Also for simplicity, I simply set the “Metadata Artifact Processing” to “Copy to Output Directory” for MergedLib. Although, getting the artifacts resources from the assembly is pretty easy (used them for the basic part). Also, make note on the limitations, both EDMX must have the same namespace (TestingEntities).

Build the application, run it, and browse to the output directory of MergedLib for the artifacts (csdl/ssdl/msdl). Notice the first time it loads, it uses the un-merged entities. Click on ‘Create’, and the xml processing happens, resulting in Schema.ssdl, Schema.csdl, Schema.msdl in the application directory. Click on ‘Load’ and ‘Extra’ to tests the newly merged entities.

Got it working? Great. So what happened? It’s a pretty simple codes, so I’m sure you can figure it out yourself :) Well, nevertheless, let me explain. Read on.

Download the source code

No related posts.