Scaffolding EntityFramework 6 Unable to cast object of type 'System.Data.Entity.Core.Objects.ObjectContext' to 'System.Data.Objects.ObjectContext'

前端 未结 3 1870
情话喂你
情话喂你 2021-02-06 08:01

I wanna use Scaffolding in EntityFrameWork 6, but get this:

Unable to retrieve metadata for \'[myNameSpace].Models.prod\'. Unable to cast object of type \

3条回答
  •  攒了一身酷
    2021-02-06 08:31

    I was battling with this kind of problem for almost 3 days, but I later found two solutions:

    Command

    1. Open an empty MVC Solution
    2. Open your Package manager console
    3. Type this command (Install-Package EntityFramework -Version 5.0.0 )

    Default Framework

    Select an internet application option of the ASP.NET MVC project template on Visual Studio 2012. By default Entity framework 5 came with it so there is no need to run your package manager console again.

    Best of luck!

提交回复
热议问题