Search code examples
c#asp.net-mvcentity-frameworkedmxdatabase-first

How can I reference two databases using Entity Framework database first?


I have an MVC project with references to two seperate projects, each of which contains an edmx. Each of the two EDMX projects point to a different database. The two databases have tables with identical names - contacts for instance. I need both, sometimes in the same controller.

I've set up two different contexts, but I get the error "contact is an ambiguous reference between model1.contact and model2.contact.

How can I use two data contexts that have identical entity names?


Solution

  • try to use fully qualified namespace and see what happens. if you hate too long namespace assign an alias for namespace