1
Reply

Two Web Apps using the same DB through EF

Rolando Alarcón

Rolando Alarcón

Mar 18 2016 9:50 AM
390
Hi,
I've started my first steps on ASP.Net MVC and I've developed a backend App as a dashboard for the application I intend to develop very soon...I coded this backend with EF using the well known "Code First", So after coding my model classes I got my DB generated with no problems...I'm also able to upgrade and downgrade this DB by using migrations too.
 
Now, I want to develop the front app(a new one) but I need to use some of the models and contexts I use in my other project(my dashboard or admin panel) to interact with...so both apps use the same DB...I will appreciate if you guys bring some light on this...and what's the best choice I have...How do I instantiate the data context which is defined in another project? I also use different solutions...I think I need to redefine my architecture, so I can solve this. I think that as the DB is already created and populated I shouldn't use the code first again in this new app, neither redefine my model classes for mapping this DB, because it already exists. Thanks.
 
 
 
 

Answers (1)