locked
Updating EF5 to EF6 Error RRS feed

  • Question

  • User-1443692344 posted

    I've updated my app EF from 5 to latest release EF6, since I'm using CF approch, I think all required changes in the imports has been automaticaly changed during the update .. fine.

    But other parts has been spoiled like, (1) when I run Asp.net Configuration from VS12 it raises this error

    [Method not found: 'System.Data.Objects.ObjectContext System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()'.]

    (2) I'm using the login wizard form which in the VS12, this one also not working anymore.

    Any idea what I need to change to solve this.

    Thaks in advance.

    Wednesday, October 23, 2013 4:22 PM

All replies

  • User697462465 posted

    Hi adscnet,

    EF 6 does not have System.Data.Objects.ObjectContext. EF 6 has moved some types, including ObjectContext, from System.Data.Entity.dll into EntityFramework.dll, and changed their namespaces. The fact that you get this error suggests you haven't attempted to recompile your application, you've simply replaced EntityFramework.dll and hoped for the best. That won't work. You need to update your code to work with EF 6: you need to remove your references to System.Data.Entity.dll, and update your code to refer to the new types.

    It just might be possible for the reference to the IObjectContextAdapter.ObjectContext property to be in some library you're using, but most likely it'll be in your own code. The error message (in the part you didn't include in your question) should tell you where it is coming from

    Please try to refer to:

    http://stackoverflow.com/questions/14106286/ef-6-system-data-objects-objectcontext-error

    Hope it helps.

    Best Regards,
    Terry Guo

    Thursday, October 24, 2013 4:40 AM
  • User-1443692344 posted

    Terry I've checked that post before but didn't help also I'v done the required changes before I post this question

    My app works find & retrieves data from my db the problem with manage.aspx page on the following line

    Dim hasLocalPassword = OpenAuth.HasLocalPassword(User.Identity.Name)
    I search all the solution trying to find any Object.Context from EF5 librery to replace it with the new one, but didn't find any.

    I'm afraid the problem coz of the conflict I'm getting when building the app & not able to resolve it

    (Warning 1 Found conflicts between different versions of the same dependent assembly. EMS_v0.1)

    also these errors:

    Consider app.config remapping of assembly "DotNetOpenAuth.AspNet, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" [..\EMS_v0.1_With_EF6\packages\DotNetOpenAuth.AspNet.4.3.3.13295\lib\net45-full\DotNetOpenAuth.AspNet.dll] to solve conflict and get rid of warning.

    Consider app.config remapping of assembly "EntityFramework, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "5.0.0.0" [] to Version "6.1.0.0" [..\EMS_v0.1_With_EF6\packages\EntityFramework.6.1.0-alpha1-21017\lib\net45\EntityFramework.dll] to solve conflict and get rid of warning.

    I removed all the nuget dependences & the data providers then reinstalled them but same problem.

    Saturday, October 26, 2013 6:07 PM