Technologies:
- C#/MVC4
- .Net 4.5
- Sql Server 2008 R2
- Entity Framework 6.1.0
Scenario: I have a several client databases that I need to interact with, and a common database that handles data that isn't specific to any one client. Most of these client databases are similar and have multiple tables with the same names and most of the same fields.
In my data tier I have several data managers who handle "targeted" data retrieval different sources. No data manager would access two client databases.
For each client database, I want to create an EF EDM to manage it. The problem I'm running into is a naming conflict that, as far as I can see, should never occur. Seeing as all DbContexts have their own namespaces and I never instantiate two client DbContext objects at the same time (ever); I'm not understanding why I am getting the following error.
Here's the error:
Schema specified is not valid. Errors: The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'itm'. Previously found CLR type 'MyData.OxiRecycle.itm', newly found CLR type 'MyData.OxiRx.itm'.
In the instantiation of the OxiRecycleDataManager, I instantiate the OxiRecycle DbContext, but not the OxiRx DbCotext.
public class OxiRecycleDataManager
{
protected OxiRecycleEntities db;
public OxiRecycleDataManager()
{
db = new OxiRecycleEntities();
}
}
Question: If I only ever instantiate one client DbContext per application per application life cycle (request), why am I getting the conflict?