I am using Entity Framework and an onion architecture to make my website maintainable and persistent. Now as I followed a particular onion architecture example, I ended up with:
Now I have separated my Entity Framework entities from my context. Entities go in the domain whereas the context goes in the repository. This means that when I enabled migrations, the configuration.cs file has been added to migrations folder in Domain
but now since Domain
has no dependencies, I have no access to my context (it is in a higher layer, therefore that would violate onion architecture rules (dependencies can't go outwards)).
enable-migrations
in repository ?configuration.cs
file is very thin, is it mandatory to keep it (it does keep AutomaticMigrationsEnabled
to false which makes me doubt this, seems like something lazy to do but who knows)?Thanks for help!
The domain should be with as few dependencies as possible, so you can:
enable-migrations
on this project. By doing this you can decouple the repositories from the context.enable-migrations
in the repository project, just as you said.I'm using the first choice in my onion-architecture project.