For years ADO.NET was the go to library for interacting with data sources from .NET applications. It gave developers a great toolkit for connecting, retrieving, updating data and executing commands against data sources. Over the years it added great features like LINQ support and progressive performance improvements. Perhaps the most important evolution was the arrival of Entity Framework, yes EF is an enhancement that sits on top of ADO.NET aimed at providing Object Relational Mapping (ORM). The goal of ORM is to help model business logic in an application by mapping objects in memory to relational databases.
We are going to talk about the reasons why Entity Framework is still relevant in modern application development and why you should consider using it when designing your next application, even if its performance is not up there with ADO.NET or Dapper.
While EF is part of the ADO.NET, it has its own module in both .NET Framework and .NET Core which allows developers to interact with data in a more object-oriented way. It takes away some of the burden of having to learn T-SQL and allows you to focus on the business logic and data itself. For this article however, we are going to focus on the go-foward specific flavor of Entity Framework; EF Core.
Things to look forward to
Temporal Tables Support
Temporal tables allow queries for data saved in the table at any point in time, as opposed to merely the most recently stored data in conventional tables. EF Core 6.0+ will support the creation of temporal tables using Migrations, as well as access to the data via LINQ queries.
As we briefly mentioned earlier in the article, Entity Framework’s performance has always been a point of contention. The community is looking to address this soon. While EF Core is generally quicker than Entity Framework 6, it has never really been able to match the performance exhibited by Dapper or even ADO.NET. There still is considerable room for performance improvements which the team intends to address through a series of iterative updates in the upcoming months.
As with anything new, sometimes features are left behind due to the natural evolution of a product, lack of demand or lack of resources to implement and execute on them all at once. This was the case between EF6 and EF Core 6. Now the team is focusing on further closing that gap which includes things like: Raw SQL Queries for primitives and unmapped types.
Microsoft is clearly slowly and steadily improving EF Core to a place where it will become the clear choice for data access and interactions from .NET applications. There are a literally thousands of proposed changes and improvement in its backlog. As it stands, its a very capable framework to build your data-driven app around. You can stay up to date on the upcoming changes and even help shape the future of the platform over at Github.
What are your thoughts on Entity Framework? Do you feel too many features were left behind on the jump to Core? Are there things you still prefer to use Dapper or ADO.NET for? Sound off in the comments below.