0

So I am using a model first EF pattern, not code first. I have my "POCOs" in separate assemblies and I getting the error:

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'request_saga'. Previously found CLR type 'MyDal1.request_saga', newly found CLR type 'MyDal2.request_saga'. this is in project.foo

So this popular SO question and answers does not solve my problem as my POCOs are in separate assemblies: The mapping of CLR type to EDM type is ambiguous with EF 6 & 5?

That is one of the two recommended solutions for this problem as can be found here:

https://social.msdn.microsoft.com/Forums/en-US/5a8ea003-c6bc-4fc6-ad2a-634f09447c49/ef4-mapping-of-clr-type-to-edm-type-is-ambiguous-error?forum=adodotnetentityframework

Giving my POCOs different names is not an option. Am I missing something? It seems very clear that having the POCOs with the same name in separate projects is a very viable solution but it is not working for me.

I should also note that other developers are not have this problem on their machines, just me on my machine.

Community
  • 1
  • 1
Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
  • Have you got a reference to the bll project with the matching poco names in your dal? if so, ef will get confused. You have to keep the two very separate if you are going to keep the same names. If other devs aren't having the issue, then try doing a clean of your solution to make sure the two dlls haven't been copied to the same bin folder by accident. The only sure answer tho, is to rename the entities in the Model, it's what I have done in the past – Slicksim Feb 11 '15 at 08:04

1 Answers1

1

I had a problem like this once that had me baffled for a while. I used data first and copied the wrong connection string. it forced EF to resolve using the wrong model. I basically started over with the connection string, and presto.

Make sure your data first connection string lists the model properties correctly.

user3097514
  • 319
  • 2
  • 6