Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC scaffolding does not support Entity Framework 6 or later

Just upgraded to Entity Framework 6 to take a look. I'm using MVC4.

But i recieve this message when trying to make a controller from a model and context.

MVC scaffolding does not support Entity Framework 6 or later

like image 355
MrBeanzy Avatar asked Oct 03 '13 17:10

MrBeanzy


People also ask

Is Entity Framework 6 still supported?

Versions 6.0, 6.1, 6.2, and 6.3 are no longer supported. Although Entity Framework 6. x is still supported, it is no longer being developed and will only receive fixes for security issues.

Can we use Entity Framework 6 in ASP.NET Core?

To use Entity Framework 6, your project has to compile against . NET Framework, as Entity Framework 6 doesn't support . NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core.

What are the features of MVC 5 scaffolding?

ASP.NET MVC 5 for Beginners ASP.NET Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio 2013 includes pre-installed code generators for MVC and Web API projects. You add scaffolding to your project when you want to quickly add code that interacts with data models.

What is scaffolding in Entity Framework?

Scaffolding a database produces an Entity Framework model from an existing database. The resulting entities are created and mapped to the tables in the specified database.


2 Answers

Thought this could use some expanding :) As mentioned above ASP.NET MVC 4 scaffolding does not support EF6 or higher. This means that an older EF, compatible with MVC 4 will have to be installed. To do this:

  1. Open the Package Manager Console:
    • select TOOLS -> Library Package Manager -> Package Manager Console
  2. In the Package Manager Console, uninstall the current EF package by executing the following command:

    UnInstall-Package EntityFramework -Version <version number>

    *Where <version number> is the version number of the EF currently installed.
    *NOTE: to find out what EF version is installed, run the following command in the Package Manager Console:

    Get-Package EntityFramework

  3. To avoid potential metadata problems the providers entry in the Web.config file will need to be removed:

    • Open the Web.config file in the project directory.
    • Delete the following lines:

      <providers> <provider invariantName=System.Data.SqlClient type=System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer /> </providers>

  4. Now, in the Package Manager Console Execute the following command to install Entity Framework 5.0.0:

    Install-Package EntityFramework -Version 5.0.0

like image 199
5had3sofQu4rtz Avatar answered Sep 20 '22 09:09

5had3sofQu4rtz


After a bit more digging

ASP.NET MVC 4 scaffolding does not support Entity Framework 6 or higher. Support of scaffolding of Entity Framework 6 is targeted for the next release of ASP.NET MVC.

So looks like ill wait until MVC 5 is properly released

like image 45
MrBeanzy Avatar answered Sep 21 '22 09:09

MrBeanzy