Question

I'm using the code-first approach (per se) in EF, however, I'm using T4 to generate a class per table, and then creating the associations in a separate partial file. I know I can use the edmx to generate poco's with table-per-type but thats not a route I want to go down.

It appears to work until I have a class name that's the same as another class, even though both classes are in different namespaces.

The solutions I've found seem to solely revolve around fixing the metadata in the connection string, however, since I have no edmx (csdl, ssdl, msl) I'm not sure how to correct the issue. Here's a related question, but the solution doesn't appear to be something that will help me - Can't have the same table names in different entity framework models?

Unfortunately just renaming the class is not a solution for us.

Here's the error:

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'AppConfig'. Previously found CLR type 'Utility.AppConfig', newly found CLR type 'Config.AppConfig'.

Was it helpful?

Solution

Apprently this is fixed in EF 6 - for code first only.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top