So I finally got some time to start looking at Code first with the Entity framework CTP3 add-on, again. While doing some testing in a test library, where I have two different StorageProviders: One for Linq to Sql and another for Entity framework 4; I found something I call a bug.
I have two classes that shares nothing except that they lie in the same assembly and have the same name. One of them is decorated with mapping attributes for L2Sql and the other has no mapping attributes, but is instead mapped via the
EntityConfiguration class, used by EF4.
The Customer classes lies in different namespaces and doesn’t share any specific base-class or interface.
First I register an ObjectSet/EntitySet and then the mappings (
EntityConfiguration) for the
Ef.Customer with my
Contextbuilder. When I then invoke
CreateObjectSet() I get promted with the exception:
Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type ‘Customer’. Previously found CLR type ‘Pls.IntegrationTestsOf.Core.Storage.L2Sql.TestModel.Customer’, newly found CLR type ‘Pls.IntegrationTestsOf.Core.Storage.Ef.TestModel.Customer’.
My opinions: If I specify the
Ef.Customer with generics the EF-infrastructure shouldn’t care about the
L2Sql.Customer. They aren’t the same. They don’t share anything except lying in the same assembly an having the same name.
Bug or by design? What do you think? Or have I done it wrong?