Entity Framework Poised to Come of Age
Microsoft is working on some major changes to how we develop applications, not only on Windows but on other platforms as well. One of the big technology changes is with Entity Framework 7. They're rewriting EF 7 from scratch to make a break from the decade-old technology of previous versions. There are a lot of things to get excited about, but some scary changes as well. Don Kiely takes a look at what the ADO.NET Entity Framework team is up to, and renews his love-hate relationship with Entity Framework.
June 4, 2015
If you’re a .NET developer of any type and have been reading DevProConnections for a while--or just paying attention--you know that the next version of .NET and Visual Studio will bring some dramatic changes. These changes are the biggest since Microsoft released the very first version of .NET Framework and development tools around the turn of the millennium. Probably the only substantial difference between this year’s updates and the initial release of .NET is that this year there will be some measure of backward compatibility with old versions.
Microsoft seems to be using this as an opportunity to overhaul related tools and technologies, both by making them open source and by rewriting them from the ground up. One prominent example of this is Entity Framework (EF), an API and toolset that I’ve long had a love-hate relationship with (as I’ve documented in my occasional articles here about EF). The next major release, EF 7, is being rewritten from scratch, freeing the codebase from the 10 year old cruft that inevitably makes its way into mature, complex software projects.
The changes are so fundamental, the EF team at Microsoft considered for a while whether this should be released as EF 7 as a major version update or as a brand-new data access technology. Rowan Miller, Program Manager for the ADO.NET Entity Framework team, explored this issue in an interesting October 2014 blog post, EF7 – v1 or v7?
One of the many big changes is that ObjectContext is getting the boot, so you’ll use the hipper and more svelte DbContext object instead. But ever since Microsoft added code-first development to EF several versions ago, that’s probably what you’ve been doing anyway, dropping down into ObjectContext only for some unusual special tasks. But fear not: some of ObjectContext’s functionality will still be available, albeit implemented different from before.
One of the more shocking changes is that .edmx files and the nifty graphical model designer are gone from EF 7. Many developers probably think of these as the embodiment of Entity Framework, and it certainly is the most visual, non-code part of the framework. Instead, in EF 7 you’ll use only the code-first workflow to create the in-memory model. Once you get beyond the panic that the familiar designer tools are going away, it’s really not a big deal. Like today, you’ll be able to reverse-engineer a database to POCO classes, Plain Ol’ CLR Objects, which EF will use at runtime to build the in-memory model. It may be distressing for those of us who are visual, but code-first is arguably the better way to use Entity Framework anyway.
But EF 7 is not all about cutting old, beloved features. There are a lot of other great new features coming. Some of the best are support for non-relational data stores, support for devices that don’t use the full .NET Framework, and a framework that is much more lightweight than earlier versions. In the What is EF7 all about topic in the Github wiki, they include this description of “EF 7 in 100 words or less”:
EF7 is a lightweight and extensible version of Entity Framework that enables new platforms and new data stores. Starting with EF7, Windows Phone, Windows Store, ASP.NET 5, and traditional desktop application can all now take advantage of Entity Framework. In addition to relational databases, EF7 also supports non-relational data stores such as Azure Table Storage and Redis.
That’s a pretty good summary to get excited about! That wiki entry has some links to blog posts that go into some detail about the best of what’s to come, as well as how to get and play with the alpha bits. One downside is that, as I write this, the team hasn’t produced much in the way of documentation for EF 7, but there are some nice sample applications floating around.
Overall, these are exciting changes for Entity Framework, but the team at Microsoft is going to have to make the initial release of EF 7 really, really good to move people off of EF 6.x. The good news is that EF 6.x has long been open source, and although it is not getting a lot of new development the code remains available and will be updated with fixes and community contributions. So don’t feel any pressure to migrate to EF 7 immediately on release. You should have a good long time to make the transition on your own terms. We’re coming upon some interesting times in data access!
If you want to read more about what’s cool in EF 7, check out Julie Lerman’s article, Looking Ahead to Entity Framework 7 in the January 2015 edition of MSDN Magazine. It’s a good overview, although getting a bit dated now. For all the latest technical information as we approach the release of EF 7, as well as the current development bits, explore Entity Framework’s new home on Github. (If you’re interested in the current released version, or earlier versions, see Entity Framework’s old home on CodePlex.) All versions going back to EF 4.1.10311 are available through NuGet.
About the Author
You May Also Like