How does the MS Entity Framework map a conceptual model to CLR types?

Given that an entity data model (EDMX) with “Code Generation Strategy” is set to “No,” how does EF determine which types of CLRs should represent a conceptual model?

I think I read somewhere that he was just exploring the assembly for types that fit the conceptual model, but this was due to the release of CTP EF. Is this still true? Can I somehow control this process?

In particular, I am in a scenario where I am moving a substantial code base using Linq2SQL to use POCO with EF 4.0. Thus, I have the Linq2SQL classes, as well as the POCO classes, which are now in the same assembly, but in different namespaces. I am trying to achieve a smooth migration from L2S to EF, so I would like the two structures to work in parallel. However, I get a runtime error saying

The mapping of the CLR type to the EDM type is ambiguous, since several CLR types correspond to the "SomeType" type of EDM. Previously found CLR type 'SomeNamespace.SomeType', recently found CLR type 'SomeNamespace.POCO.SomeType'

where SomeNamespace is the namespace of the L2S objects. This error makes sense if EF just examines all types that fit the conceptual model. Can I restrict EF to explore the SomeNamespace.POCO namespace? Or should I put POCO objects in another assembly? Or should I take a third approach?

Thank.

+2
source share
1 answer

Check out this comment from the ADO.NET Team Blog:

Jeff 25 Feb 2010 9:10 AM @Derek

. POCO . . , ( namespace) EntityType ( edmx/csdl).

, , , . , , .

. :

+4

All Articles