Just another WordPress site
Merging Entity Framework metadata/definition
Ok, now, here’s the sample 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):
And in MergedLib, the extra part (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.
No related posts.
| Print article | This entry was posted by Hendry on September 25, 2010 at 1:25 am, and is filed under .NET. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |



about 7 months ago
Our project which is model based has just hit the large entity framework boundary so I’ve been looking for a solution to break up the designer models that has the least impact on the project going forward.
So thanks for writing this its great.
SimBu ;o)