Search code examples
c#.netentity-frameworkentity-model

Is it possible to have two Entity Models from two databases in one project?


I used to have one Working edmx model with WCF service.

Then I've added another Entity Model pointing another connection.

I will try to explain in nutshell what is happened in app.config.

  • there is still being one connectionString with old name
  • but now it points new entity model
  • but initial catalog is not even updated to new one and points to old one

I'm sure that something is wrong here. And I also can't find can I change / edit it from properties.

Is it possible to have two Entity Models in one project? If so then what could cause such things in my situation?


Solution

  • I had a similar problem a while back where I had two models in one project which worked fine at first. My problems started when I had to reference the same table in both models, specifically as the generated POCOs were in the same project.

    In the end, put the two edmxs in separate projects. Julie Lerman in this tutorial says this is a perfectly fine thing to do.