Architecting multi-model multi-DB ASP.NET MVC solution
Posted
by
A. Murray
on Programmers
See other posts from Programmers
or by A. Murray
Published on 2013-10-10T12:22:03Z
Indexed on
2013/10/18
10:15 UTC
Read the original article
Hit count: 403
I have an ASP.NET MVC 4 solution that I'm putting together, leveraging IoC and the repository pattern using Entity Framework 5. I have a new requirement to be able to pull data from a second database (from another internal application) which I don't have control over.
There is no API available unfortunately for the second application and the general pattern at my place of work is to go direct to the database.
I want to maintain a consistent approach to modeling the domain and use entity framework to pull the data out, so thus far I have used Entity Framework's database first approach to generate a domain model and database context over the top of this.
However, I've become a little stuck on how to include the second domain model in the application.
I have a generic repository which I've now moved out to a common DataAccess project, but short of creating two distinct wrappers for the generic repository (so each can identify with a specific database context), I'm struggling to see how I can elegantly include multiple models?
© Programmers or respective owner