I have a problem with EF. It started when I moved my model to separate projects. The error is:
Object mapping could not be fou开发者_StackOverflownd for Type with identity ''
My code:
protected EntityKey Key(int id)
{
return new EntityKey(InstanceContext.GetType().Name + "." + typeof(T).Name, "Id", id);
}
protected object CurrentObject(int id)
{
return InstanceContext.GetObjectByKey(Key(id)); //**<-- error**
}
What is worse, when I put a break-point, it works fine. I get the entity without a problem.
精彩评论