开发者

Moving model to different project causes error: Object mapping could not be found for Type with identity

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜