Entity Framework Core 2.0 Released

Microsoft has released the final version of Entity Framework Core 2.0. The company has released this new version of its lightweight, extensible, and cross-platform version of Entity Framework along with the release of .NET Core 2.0  and ASP.NET Core 2.0.
 
As described in the announcement,
 
“You can start using EF Core 2.0 today by installing an EF Core 2.0-compatible database provider NuGet package in your applications. E.g. to install the SQL Server provider from the command line in a .NET Core 2.0 application:
  1. $ dotnet add package Microsoft.EntityFrameworkCore.SqlServer -V 2.0.0  
Or from the Package Manager Console in Visual Studio 2017:
  1. PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 2.0.0  
Note that the SQL Server, SQLite, and in-memory database providers for EF Core 2.0 are already included in the ASP.NET Core 2.0 meta-package. Therefore, if you are creating an ASP.NET Core 2.0 application, these steps won’t be necessary.”
 
This is but obvious that the new version is equipped with several bugfixes as well as many new features and updates. Let’s have a look at these changes that Entity Framework Core 2.0 encapsulates, according to the official blog.
  • EF Core now targets the new .NET Standard 2.0. With .NET Standard 2.0, developers can reuse their code and skills on a wide range of platforms, application types, and devices.

  • Queries are more efficient in EF Core 2.0 in multiple scenarios. As an example, Microsoft has increased the number of patterns that can be translated to SQL.

  • You can now use EF.Functions.Like() in a LINQ query and it will be translated to LIKE in SQL or evaluated in memory if necessary.

  • You can now define “owned” or “child” entities which group properties within other entities. In combination with table splitting, owned types allow these two entities to be automatically mapped to a single table.

  • You can now specify filters in the model that are applied automatically to all entities of a type in all queries executed on the DbContext.

  • DbContext Pooling is now added so that many ASP.NET Core applications can obtain a performance boost by configuring the service registration of their DbContext types to use a pool of pre-created instances.
Microsoft says,
 
“We have added a few more features such as explicitly compiled queries, self-contained entity configurations in code first and database scalar function mapping (thanks to Paul Middleton for a great contribution!), and we have fixed lots of bugs.”
 
For complete information, you can go through the "What's New" page of Entity Framework Core 2.0, and download the latest version from GitHub.
 
Up Next