EF 6 System.Data.Objects.ObjectContext Error

前端 未结 10 627
孤独总比滥情好
孤独总比滥情好 2020-12-03 09:40

I recently upgraded from Entities Framework 5 to Entities Framework 6 Alpha 2 and I am getting the following error:

Method not found: \'System.Data.Ob

相关标签:
10条回答
  • 2020-12-03 10:08

    The new 2.0 version of the providers (http://www.nuget.org/packages/Microsoft.AspNet.Providers.Core/) are EF6 compatible (they'll actually only work with EF6).

    0 讨论(0)
  • 2020-12-03 10:09

    I'm also using EF 6.

    I managed to solve the problem uninstalling the package Microsoft.AspNet.Providers.Core v. 1.2. I'm using version 1.1 instead. If you're like me and is using LocaDb, you'll have to uninstall the LocaDb package because it depends on that package. Of course you'll have to reinstall LocaDb again...

    You can grab v. 1.1 using the NuGet Package Manager Console inside Visual Studio:

    Install-Package Microsoft.AspNet.Providers.Core -Version 1.1
    

    There's a Microsoft Connect bug filled regarding this issue:

    Microsoft.AspNet.Providers.Core incompatible with EF6

    0 讨论(0)
  • 2020-12-03 10:09

    I managed to resolve this by removing the AspNet Providers I had installed through Nuget, which was marked as deprecated. Doing this also uninstalled Entity Framework.

    I then installed the new AspNet Universal Providers, followed by Entity Framework 6, and all my problems were fixed.

    0 讨论(0)
  • 2020-12-03 10:12

    It has an old version associated with edmx file for this:

    • Reinstall EF with Nuget
    • Delete the .edmx file and recreate it with tables
    0 讨论(0)
  • 2020-12-03 10:16

    That happens when entity framework is unable to find the method in the dotnet framework library installed in the machine. So install dotnet framework 4.5.2 or higher. It will fix the issue.

    0 讨论(0)
  • 2020-12-03 10:19

    For me updating these below worked:
    using System.Data.Objects; --> using System.Data.Entity.Core.Objects;

    using System.Data.Objects.DataClasses; --> using System.Data.Entity.Core.Objects.DataClasses;

    0 讨论(0)
提交回复
热议问题