The information in this post is out of date.
Visit msdn.com/data/ef for the latest information on current and past releases of EF.
We recently posted about our plans to rationalize how we name, distribute and talk about releases. We heard a resounding ‘Yes’ from you so then we posted about our plans for releasing EF 4.2.
We then shipped a Beta and a Release Candidate of EF 4.2. Today we are making the final release of EF 4.2 available.
EF 4.2 = Bug Fixes + Semantic Versioning
When we released ‘EF 4.1 Update 1’ we introduced a bug that affects third party EF providers using a generic class for their provider factory implementation, things such as WrappingProviderFactory<TProvider>. We missed this during our testing and it was reported by some of our provider writers after we had shipped. If you hit this bug you will get a FileLoadException stating “The given assembly name or codebase was invalid”. This bug is blocking some third party providers from working with ‘EF 4.1 Update 1’ and the only workaround for folks using an affected provider is to ask them to remain on EF 4.1. Third party provider writers then identified some areas in EF where it was hard to get EF to work with their providers, so we decided to address these issues in the EF 4.2 release. These provider related changes will be the only changes between ‘EF 4.1 Update 1’ and ‘EF 4.2’.
Obviously a single bug fix wouldn’t normally warrant bumping the minor version, but we also wanted to take the opportunity to get onto the semantic versioning path rather than calling the release ‘EF 4.1 Update 2’.
Getting Started
The following walkthroughs are available for EF 4.2:
Getting EF 4.2
EF 4.2 is available via NuGet as the EntityFramework package. If you already have the EntityFramework package installed then updating to the latest version will give you EF 4.2.
Code First Migrations
To use Code First Migrations with EF 4.2 you will need to upgrade to the latest version of the EntityFramework.Migrations NuGet package.
Failure to update to the latest version of Code First Migrations will result in an error stating “Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.“
After updating to the latest Code First Migrations package you will need to close and re-open Visual Studio.
Model First & Database First Templates
The templates for using the DbContext API with Model First and Database First are now available under the “Online Templates” tab when “Right-Click –> Add Code Generation Item…” is selected on the EF Designer.
Support
This release can be used in a live operating environment subject to the terms in the license terms. The ADO.NET Entity Framework Forum can be used for questions relating to this release.
What’s Not in This Release?
As covered earlier this release is just a small update to the DbContext & Code First runtime. The features that were included in EF June 2011 CTP require changes to the Core Entity Framework Libraries that are part of the .NET Framework and will ship at a later date.
Our Code First Migrations work is continuing and we are working to get the next release in your hands soon.
ADO.NET Entity Framework Team
That's great! Thank you ADO.NET TEAM!
I'm excited for the futures news.
I'm always glad to see progress made on such a great toolset. I will continue to wait to use EF Code First, however, until this matter has been addressed, ..
stackoverflow.com/…/cannot-rename-discriminator-column-in-entity-framework-4-1-code-first-database
.. namely the refined ability to rename and control the Discriminator column. I need confidence that I have full control over generated DB schema when working with Code First.
Thanks a lot. What about SQL Compact support for Entity Framework? Previously we had 'System.Data.SqlServerCe.Entity'. What do you plan to update it for the latest version?
Is this bug fixed? stackoverflow.com/…/entity-framework-generating-left-outer-joins-when-it-should-be-doing-inner-joins I believe I was still experiencing it in EF4.1latest
1. Am I to construe the latest EF 4.2 is an RTM version?
2. What's the download link to get EF 4.2 for those of us who don't trust/use NuGet?
Thanks.
Thanks for not ignoring database first approach. Remember that lots of people don't use code first approach in big projects !
Hi, this is great news. Any news on how to use enums in Code First?…. can't wait 🙂
Please add support for table valued functions for Code-First.
Its great.
Any plans for future adding Interceptors?
@Jon Davis – We are taking a look at this issue now.
@What about SQL Compact – The SQL Compact 4.0 provider has full support for EF, including database generation from Code First. You can get SQL Compact 4.0 via the SqlServerCompact NuGet package.
@foobar – Confirmed, this is a fully supported RTM. We are only releasing on NuGet now, more info on that decision here; blogs.msdn.com/…/ef-releases-amp-versioning-call-for-feedback.aspx
@Merijn van Mourik – Enums requires some changes to core components in .NET. We’ll be releasing an update to Code First alongside the next .NET Framework update that enables the use of enums (and other new features) in Code First.
The insert still generates null for Default values, why can't the Generated Insert Statement only have columns with values and ignore unassigned properties, in other words (use SQL defaults for non nulls on insert), or at least make it optional etc.
"Semantic Versioning"
Good to hear, thanks for listening!
@Matt Hinze – The next .NET release includes some updates to core libraries that reduce when we do outer joins instead of inner joins. Unfortunately because this is a change we need to make to the .NET libraries we couldn’t get it into this release.
@Khaled – TVF support required some changes to the core libraries in .NET. We will release an update to Code First alongside the next .NET release that supports TVFs.
@Kris444 – Are you referring to query interceptors? If so, we do have this on our backlog but there are no firm plans around when we would tackle it.
@Vasim – This is something our team has talked about. We don’t have any plans around supporting it yet but it is something we are aware of.
Does the EF 4.2 contain the Improvements for TPT Querie mentioned in the June CTP?
Great stuff guys. I remember hearing at build!, but didn't actually see, that there is now support for the story between EF and Database Projects. Ideally for me what this means is when I amend a code-first class hierarchy, or change an EF4 model and hit generate database script, is that it updates the Database Project, which realistically is the best way by far to maintain and update production databases – you can't simply run the EF code-first migrations on a live database.
What's the latest with this?
Cheers
Isaac
Entity Framework is a great tool, however the way you deal with error notifications leaves a lot of space for improvement. I have created an error notification almost a month ago and I still did not get any reply.
connect.microsoft.com/…/dbentityentry-getdatabasevalues-method-crashes-when-db-context-has-different-namespace-than-the-data-objects
Cheers,
Michal Wozniak
If you want to make use of the new enum functionality in the June CTP you can't use pocos. How come you can't use both pocos, EF4.2 and the enum functionality? Or if u can, could you elaborate how…
Where can we get the online templates if our company blocks the Visual Studio online templates via proxy server?
Never mind …. I found them in the VS Gallery online
is there gonna be a feature to update an no-tracked eintity coming from a differen context. kind like merge where u can have an entity coming from a diffent context and this entity and its child can be updated in current context with out complicated conding.
Why are you only releasing on NuGet? Not everyone has or uses NuGet. Until NuGet is built into Visual Studio it shouldn't be the only distribution method. You are alienating a large group of users. I don't like NuGet but you are saying if I want to user EF 4.2 I have to get NuGet. Come on Microsoft, you should always post a full install in your standard downloads area.
Thanks Rowan Miller, great product BTW! – Just needs some refinement IMHO.
Amazing how many people are asking about things that have already been explained (in this post even). Folks, wait for .NET 4.5, *then* you'll have enums, TVF, query improvements and everything else that required updates to the BCL that couldn't be shipped out of band. RTFP.
And who doesn't trust NuGet? Seriously? Is it because there's a bug affecting you? Here's an idea: contribute to the project. Honestly. "Microsoft doesn't support Open Source enough" "Microsoft should be doing this themselves". Microsoft spawned NuGet in the open source arena. Quitcherbitchin.
</rant>
When will 4.2 be avaliable as a standalone installer?
It seems like including libraries like EF as part of the base .NET framework is a mistake if that means waiting for major framework releases to get updates. They made the same mistake of adding everything including the kitchen sink to the Java runtime, resulting in people creating their own libraries instead of waiting for the runtime to be updated. I suppose that, for this reason, something like NHibernate will always be the better choice. We shouldn't have to roll out a new framework to get "enums, TVF, query improvements and everything else".
+1 on making EF 4.2 available as a standalone installer!
A post of what EF tools work or do not work with 4.2 would be handy. I'm trying to get started with this, and getting my machine set up correctly feels like a 1991-style deployment nightmare.
+1 on making the goods avail. via standalone installer! 🙂
Great work!
Is it possible for the EF product to participate in Microsoft Connect??
when will this support encryption? probably the single most important thing it's missing. When hell freezes over? I should have never started using this at version 1. I still can't do what I need.
Can we get a direct download link? NuGet has a bug where it refuses to install all of the templates required to use EF 4.1/4.2. Previous posts said that the only way to solve this problem was to avoid NuGet and install 4.1 directly from the download link.
I installed 4.2 directly using NuGet and bypassed 4.1, but of course I'm missing those templates. I'd really like to get the issue fixed – please post a link to the MS download site!
How do the new code get onto servers? Will the new binaries just be complied into the bin directory?
Want to work hard in the implementation of efficiency
When will the new EF / .NET 4.5 come out with full support for spatial and geography types?
@Luis: unfortunately we don’t have a date we can share at this point.
@SC the T4 templates for DbContext are not included in the NuGet package. You have to download them from the Visual Studio Gallery as described in the "Model First & Database First Templates" section in this blog post.
By the way, if the need arises, the NuGet Gallery site (http://nuget.org) has a new feature that provides a download link for the package. Keep in mind that you need to be logged on the site for the download link to appear and also that you might need to change the extension of the downloaded file to .zip in order to see its contents.
@David McCarter: yes you can simply deploy EntityFramework.dll as part of your application to the server.
@Paul: Look in the "Model First & Database First Templates" section in the blog post. All you need to do to work with the Entity Designer and this version of EF is to add the DbContext template and the EF NuGet package. The rest stays the same.
@Creepy Gnome: it would be very interesting for us to learn why you don't like NuGet.
@Lars: enum property support will be enabled by changes that will be included in .NET 4.5, both for POCO and non-POCO classes. We will ship a preview version of EF that will support enums in Code First and DbContext as soon as the next pre-release version of .NET 4.5 goes out.
I have to agree with the others that are opposed to using NuGet. When using TFS (which is fully supported) it is a major PITA trying to set things up correctly as the "packages" folder is outside the folder structure of all projects. You can't just open a solution, do a "Get Latest" and get the updated package files unless you manually build the entire packages folder structure using solution folders. I can't understand how you guys didn't see this as you are required to dog-feed yourselves and use TFS.
Is there a plan to support SQL Server 2012. Specifically using sequence to generate primary key and pagination using the offset / fetch clause as in msdn.microsoft.com/…/ms188385(v=sql.110).aspx.
Hi folks! I'm trying to use ef4.2 with VS2011 developer preview. The installation via nuget worked fine but I'm no able to find the dbcontext templates. I followed the instructions to find it online but it does not worked too. Any help will be very appreciated.
We need an installer. Working for Federal Agency that does not allow me to access Nuget download content….it's going to take forever for me to get authorization to access this……
thanks
+1 for a non-NuGet accessible download.
How about WCF DataServices?
Oracle finally has issued a data base driver that support EF, however, only up to EF 4.2. There is a T4 Template "EF 4.x DbContext Generator" which works very well. There is a "ADO.NET DBContext Generator with WCF support" which does not work with EF 4.2. That's a pity – since Oracle support only EF 4.2 that means with Oracle we cannot utilize WCF DataServices. Could you produce a "EF 4.x DbContext Generator with WCF support" for poor guys like us tied up to EF 4.2?
@GSchneider – I just tried the "ADO.NET DBContext Generator with WCF support" and it all seemed to work. The only major difference between 4.1 and 4.3 is the addition of Code First Migrations which shouldn't impact it's use with WCF Data Services. If there is something blocking you using the template then start up a Stack Overflow thread with details and we'll help you work through it.
BTW – Given you are using the designer, rather than Code First, there shouldn't be any issues using the Oracle provider with the latest version of EF.