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:

git@github.com:damienbod/EF5DomainTest.git

2 comments

  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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: