0

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?

tintyethan
  • 1,772
  • 3
  • 20
  • 44
  • How does your model namespace looks like? – qamar Jun 20 '14 at 15:11
  • The namespaces are just the name of the projects... – tintyethan Jun 20 '14 at 15:22
  • try to use fully qualified namespace and see what happens. if you hate too long namespace assign an alias for namespace – qamar Jun 20 '14 at 15:30
  • do you mean whenever I reference the entities in code? I would have to do that throughout my project...I hope there's another way. – tintyethan Jun 20 '14 at 15:34
  • If you have resharper then you might be able to do it faster :) But before that try full namespace in one place and see it that solves some of the error – qamar Jun 20 '14 at 15:36
  • Actually, for this particular project, I only have to do it in 2 controllers, so maybe not that big of a deal. This appears to be a good solution. Put it in a real answer and I'll mark it as correct. – tintyethan Jun 20 '14 at 15:42

1 Answers1

1

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

qamar
  • 1,437
  • 1
  • 9
  • 12