I have a web application on a web farm and i use .NET 4 and entity data model 4.1.
when i started working on this web application i used visual studio 2010, and today i have uninstalled it and installed new version (Visual Studio 2012).
Due to some reasons, i have deleted my ado.net entity data model to recreate it, but i
pay attention that visual studio 2012 use entity framework 5
not 4.1. I have updated it but in old model i can context constructor to change my connection string but in this new model have no constructor, is that true?
I have installed EF 4.1
but it doesn't works and I've added version 5 to my project.
Background info: my web application is on a shared host and i can not update it to EF 5.
How can i use entity framework 4.1 in visual studio 2012 ? is that possible? if yes, how?
In this situation you can upgrade to EF5 using the following steps: Select Tools -> Library Package Manager -> Package Manager Console. Run Install-Package EntityFramework -version 5.0. 0.
Remove the existing reference (to Entity framework 5) under the References section in your Project in Solution explorer.
Remove the corresponding entry from your packages.config file. If you open the packages.config file, you will see an xml structure and you will see an element with id EntityFramework
with version
attribute value as 5.0.0
. Remove that line( that package element).
Now go to the package manager window(View->Other Windows -> Package Manager Console) and execute the following command there.
Install-Package EntityFramework -Version 4.1.10331.0
This will download EF 4.1 to your project and you will see the success message like below.
Reference : http://nuget.org/packages/EntityFramework/4.1.10331.0
Always keep in mind that there are a lot of improvements made in EF 5. So consider to consume all those as possible as you can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With