How can I use Entity Framework 4.1 in Visual Studio 2012?

I have a web application on a web farm and I am using .NET 4 and entity data model 4.1.

when I started working on this web application, I used visual studio 2010, and today I uninstalled it and installed the new version (Visual Studio 2012).

For some reason, I deleted my ado.net entity data model to recreate it, but I
note that visual studio 2012 uses entity framework 5 not 4.1. I updated it, but in the old model, I can change the context constructor of my connection string, but there is no constructor in this new model, is that true?

I installed EF 4.1 , but it does not work, and I added version 5 to my project. Background information: my web application is on a shared host and I cannot upgrade it to EF 5.

How can I use framework 4.1 entity in visual studio 2012? is it possible? if so, how?

+7
source share
1 answer

Delete Existing (Entity 5 Infrastructure)

  • Delete the existing link (in the Entity 5 infrastructure) in the "Links" section of your project in Solution Explorer.

  • Remove the appropriate entry from the packages.config file. If you open the package.config file, you will see the xml structure and you will see the element with EntityFramework ID with the version attribute as 5.0.0 . Delete this line (this package element).

Add again (Entity 4.1 framework)

Now go to the package manager window ( View-> Other Windows → Package Manager Console ) and run the following command.

 Install-Package EntityFramework -Version 4.1.10331.0 

This will load EF 4.1 into your project and you will see a success message, as shown below.

enter image description here

Link: http://nuget.org/packages/EntityFramework/4.1.10331.0

Always remember that there are many improvements to EF 5. Therefore, consider that you can use all as much as possible.

+10
source

All Articles