The MVC base frame does not support Entity Framework 6 or later versions.

Source: Internet
Author: User

The MVC base frame does not support Entity Framework 6 or later versions.

The MVC base frame does not support Entity Framework 6 or later. For more information, visit the http://go.microsoft.com/fwlink? LinkId = 276833.


PS: What I encountered when I started to build a new small system.

After reading this article, EF has been upgraded from EF5 to ef6. the NuGet package is updated directly to the latest version.

My VS2012 is also the highest MVC4, so the tragedy is not compatible.

The conclusion is MVC4 + EF5 or MVC5 + EF6.

Lower the version.


The procedure is as follows:

Tool-library Package Manager-package Management Console

First look at http://blog.csdn.net/sat472291519/article/details/19114921 blog

1. Uninstall ef 6.1 from NuGet.

2. modify the original statement Install-Package <Package name>-Version <Version number>

Install-Package EntityFramework-Version 5.0.0

<Package name> it can be viewed from the NuGet manager or in packages. config.

<Version number> if you know the version number, enter it directly. If you do not know the version number, you need to go to the official website to check the total number of versions you have selected.


Finally, update the matching Chinese Language Pack.

Install-Package EntityFramework. zh-Hans-Version 5.0.0


Visual Studio 2010 (Net Framework4) supports Entity Framework 6

Fully supported. It comes with MVC2.0. You can download a 3.0 package and I will be using it !!
 
Mvc + entity framework database first, each time the generated model is updated to a table, all models will be updated.

When using the Database frist or model first of the Entity Framework, adding attribute directly to the modle class is too realistic and unreasonable, because the model class is automatically generated, after the code is regenerated, its modifications will be overwritten. A reasonable practice is to use the partial class method.
For example, there is a Model class: Movie. Then we can add a local class file. The content of the local class is as follows:
Using System. componentModel. dataAnnotations; namespace Movies. models {[MetadataType (typeof (MovieMetadata)] public partial class Movie {class MovieMetadata {[Required (ErrorMessage = "Titles are required")] public string Title {get; set ;} [Required (ErrorMessage = "The Price is required. ")] [Range (5,100, ErrorMessage =" Movies cost between $5 and $100. ")] public decimal Price {get; set ;}}}}
You can add the required verification attribute to this local class file.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.