Entity Framework support for multiple domains

Discovered a cool feature in EF5. You can create multiple Edmx models in one .NET project. You can now create multiple domains with separate domain models within the same assembly. Up to now, I had one large Edmx file with all the required db objects for all my repositories and also only in one color. I am no longer forced to create multiple domain assemblies.

Here an example for my business domain:
EF domain Business

And another domain for my diagnostics…
EF domain Diagnostic

With this I can separate domains as I wish. For example, configuration data could be loaded per application lifecycle, or business entities can be load per web request…

If I mix this with the repository pattern, use an IoC, I have the basis for a solid backend tier of an application which can remain readable with large database schemas.

here’s source code of a simple hello world example:



  1. Do you mind if I quote a couple of your posts as long as I provide
    credit and sources back to your webpage? My blog site
    is in the exact same niche as yours and my visitors would definitely benefit
    from a lot of the information you present here.

    Please let me know if this ok with you. Many thanks!

    1. No Problem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: