ObjectContext.GetObjectType(e.GetType()) not returning the entity type of the POCO entity

本秂侑毒 提交于 2019-12-01 10:39:16

You are using the wrong ObjectContext. EF6 is not built on System.Data.Entity.dll. You need to use ObjectContext from EntityFramework.dll. It's actually not recommended to have a reference to System.Data.Entity.dll in your project at all if you are using EF6 to avoid situation like this.

To fix your issue:

  • remove the reference to System.Data.Entity.dll (just in case)
  • replace System.Data.Objects.ObjectContext.GetObjectType(e.GetType()); with System.Data.Entity.Core.Objects.ObjectContext.GetObjectType(e.GetType())
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!