Entity Framework 4.1 Release Candidate with Go-Live (with Final Release to follow in a month)
I was in Redmond this last week and talked to Jeff Derstadt, the Lead Developer on Entity Framework Code First (or, as I say, EF Magic Unicorn). What's the deal with this new feature in Entity Framework? What about the bad rap that EF got back in the day? What's new in EF4 and how does EF Code First sit on that? Which is the right choice, Model First, Database First or Code First? All of this plus demos in this off-the-cuff interview. There's lots of good info in this video including some insight into much needed migrations. Hint: They are working on them!
This week, the Entity Framework team put out a Release Candidate of Entity Framework 4.1, and are planning a final release in a month. Hm, what conference happens in a month?
The EF 4.1 RC is now publicly available (“ADO.NET Entity Framework 4.1 Release Candidate” for short, doh!) It's cool that they are able to do out of band releases for things like this, so we don't have to wait a year or more for new functionality.
Note that while CodeFirst is awesome, EF4.1 is not just about Code First, the DbContext API is equally applicable to Database First and Model First and EF 4.1 includes new code generation item templates for customers working with the EDM designer.
What’s in EF 4.1 RC?
From their blog, the ADO.NET Entity Framework 4.1 RC introduces two new features:
- The DbContext API is a simplified abstraction over ObjectContext and a number of other types that were included in previous releases of the ADO.NET Entity Framework. The DbContext API surface is optimized for common tasks and coding patterns. DbContext can be used with Database First, Model First and Code First development.
- Code First is a new development pattern for the ADO.NET Entity Framework and provides an alternative to the existing Database First and Model First patterns. Code First is focused around defining your model using C#/VB.NET classes, these classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API.
And an unfortunate but necessary NuGet gotcha, as the package as been renamed.
NuGet Package Rename
Previous releases of Code First were made available as the "EFCodeFirst" NuGet package. The EF 4.1 RC release contains features that are also applicable to Model First and Database First development, therefore we have chosen to adopt the "EntityFramework" package name for this release, and future releases. If you are currently using the "EFCodeFirst" package you will need to swap to the "EntityFramework" package to get the supported go-live release. If you own a package that depends on ‘EFCodeFirst’ we would encourage you to swap the dependency over to the ‘EntityFramework’ package as soon as possible.
Have you implemented the NuGet Action Plan? Get on it, it'll take only 5 minutes: NuGet Action Plan - Upgrade to 1.1, Setup Automatic Updates, Get NuGet Package Explorer.
Related Links
- Simple Code First with Entity Framework 4 - Magic Unicorn Feature CTP 4
- Go to the EF Forum for support and questions
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Previously I used Entity Framework 4.0 CTP5 (code-first) and SQL Compact in my projects. I had the following packages installed using NuGet:
1. SQLCE.4.0.8435.1 (version 4.0.8435.1)
2. EFCodeFirst 0.8 (version 4.0.30319.0)
3. EFCodeFirst.SqlServerCompact.0.8 (version 4.0.8435.1)
Now when EF 4.1 RC is published, I want to update all my libraries to the latest version. NuGet feed doesn't contain any updates for SQLCE.4.0.8435.1 anymore, but it has a new package 'SqlServerCompact - 4.0.8482.1' (new package, not a new version of existing package). Presume, that it was just renamed and I should install it. Is it right? Presume, yes.
So what should I install now? Are 'EntityFramework 4.1.10311.0' and 'SqlServerCompact - 4.0.8482.1' enough for using EF code first with SQL Compact? Where is old 'EFCodeFirst.SqlServerCompact' (is it required)?
at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.InternalContext.Initialize()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
http://stackoverflow.com/questions/5365376/system-nullreferenceexception-after-upgrade-to-ef-4-1
Any ideas?
http://data.uservoice.com/forums/72025/suggestions/1547469
Comments are closed.
"Previous releases of Code First were made available as the "EFCodeFirst" NuGet package."