I just upgraded my project from asp.net 2 to asp.net 4. More precisely I converted the project from VS 2008 to VS 2010. I did this because I needed the new features of EF4. I am running into an issue though where I am getting this error message:
The types in the assembly 'XXX' cannot be loaded because the assembly contains the EdmSchemaAttribute, and the closure of types is being loaded by name. Loading by both name and attribute is not allowed.
After some playing around I found that the cause is context.GetObjectByKey
. I had a little function that would take an object id and build an EntityKey
from it for use in GetObjectByKey
. If I change that to context.ObjectName.FirstOrDefault(x => x.id == searchId)
then I don't get the error anymore.
I'm in the process of updating all my code to the version that works but I'm wondering if anybody knows the reason for this? Or does it indicates some underlying issue with my code; perhaps that my EDM got munged in the conv开发者_运维技巧ersion?
Is your entity really called "object?" That might be the problem. Having an entity with the same name as the root CLR type is certainly going to be an issue.
精彩评论