EF Core – What is it?

I have been meaning to write something on EF Core, a topic that is near and dear to my heart.

Microsoft has done phenomenal work in shaping this ORM what has turned out to be a real hot product, although the best is yet to come! In doing so, they have left no stone unturned in promoting EF Core in major conferences across the globe. This aggressive approach to this otherwise new technology has clearly resonated loud and clear amongst the developer community in particular and corporates in general. As a result, EF Core has already begun to gain traction.

Make no bones about it…EF Core is new and it’s still a version 1.0 product. Therefore, it wouldn’t be fair to compare it with its predecessor that has gone through numerous iterations for over eight years now.

So what exactly is EF Core (formerly EF7) and how is it different from Entity Framework?In Microsoft’s own words, Entity Framework (EF) Core is a lightweight and extensible version of the popular Entity Framework data access technology. EF Core is an object-relational mapper (ORM) that enables .NET developers to work with a database using .NET objects. It eliminates the need for most of the data-access code that developers usually need to write.

The most current release of Entity Framework i.e. 6.1.3 is by far the most stable product we have seen yet! It has gone through eight plus years of development, bug-fixes and constant improvement thus providing a rich eco-system of data providers. These database providers are predominantly relational. Having said that there should be no doubt that Entity Framework is mature which offers a rich set of features such as Creating Model using Spatial data types, Many-to-many relationships, Visualizing a model, Alternating inheritance mapping patterns to Lazy Loading, Saving Data and Database Schema Management just to name a few!!

EF 6.x to EF Core is “Port” not an “Upgrade”

What it means is that there is no upsize wizard that can magically update all your Entity Framework project(s) to EF Core. Furthermore, EF Core does not support the EDMX file format for models. In order to port your model, your best bet is to reverse-engineer your model from the database for your application.

While EF Core is built with a lot of the same API’s, their implementation is totally different. For example, some of the common top level API’s such as DbContext, DbSet are still the same which in my opinion is a wonderful thing. Having said that, these top level API’s which are also part of EF Core are highly optimized and are guaranteed to give a significant boost when performing CRUD operations against a data store.

EF Core is made up of core components which in essence are a collection of loosely coupled services. There are categories of services ranging from Context, Provider specific, Design-time and User services.

Database Providers

Another important aspect of EF Core is that it can target a slew of data stores irrespective of whether they are relational or non-relational. Unlike Entity Framework which can only target relational databases namely, SQL Server, Oracle etc. EF Core can target these, but also target non-relational ones such Redis, In-Memory (for Testing) etc.

Which One is Right for You

Don’t be afraid to use EF 6.x if you are building an enterprise app. EF 6.x is tried and tested technology with many years of features, bug fixes and stabilization. However, if you are building an application that is cross-platform or if it targets ASP.NET core, then EF Core is definitely the right choice. The diagram below illustrates the platforms and App Models that EF 6.x and EF Core support.


About Obi Oberoi

I am Technology Aficionado who has a passion for learning, speaking, blogging and hanging out with geeks and like minded people!
This entry was posted in ORM. Bookmark the permalink.