Introduction to Entity Framework Core

In this tutorial will discuss about entity framework overview and will understand below points.

What is EF Core

Entity Framework Core, also called EF Core is a complete rewrite from the ground up. If you have any experience with previous versions of Entity Framework, you will find lot of familiar features. 

EF Core is an ORM (Object-Relational Mapper). EF core is lightweight, extensible, and open source software. Like .NET Core, EF Core is also cross platform. It works on windows, Mac OS, and Linux. EF core is Microsoft’s official data access platform.

What is ORM

ORM stands for Object-Relational Mapper and it enables developers to work with a database using business objects. As a developer we work with the application business objects and the ORM generates the SQL that the underlying database understands. In-short, an ORM, eliminates the need for most of the data-access code that developers usually need to write. 

EF Core is an object-relational mapper (ORM) that enables .NET developers to work with a database using .NET objects. It is a lightweight, extensible and can be used across various platforms It eliminates the need for most of the data-access code that developers usually need to write.

Entity Framework Core 2 brings more features that many developers needed in earlier versions of EF, as well as new innovations beyond Entity Framework Core 1.

Supported Database Providers

Entity Framework Core supports many relational and even non relational databases. EF Core is able to do this by using plug-in libraries called the database providers. These database providers are available as NuGet packages. 

      • SQL Server
      • MySQL
      • PostgreSQL
      • SQLite
      • SQL Compact
      • In-memory

Features of Entity Framework Core

LINQ

LINQ queries have been made more efficient and LINQ querying methods will be able to become part of the SQL that’s run on the database, rather than left for post-query client-side evaluation.

Filters

It is now possible to define query filters in your DbContext for individual entities, and these filters will be applied to any queries that your app is executing before that query goes to the database. GroupJoin Improvements If you use GroupJoin in your queries, the generated SQL is much smarter in EF Core 2 than it was in the first version of EF Core.

Mappings

Mapping database scalar functions to method stub so that they can be used in LINQ queries and translated to SQL. In EF Core 1, there was no support for value objects, but now in EF Core 2, we have something better that replaces complex types and it’s called owned entities.

Table Splitting

Table splitting is now possible to map two or more entity types to the same table where the primary key column(s) will be shared and each row will correspond to two or more entities.

DbContext pooling

DbContext pooling is a really cool performance feature that allows EF Core at runtime to use a pool of pre-created DbContext instances, rather than instantiating a new context every time.

You can watch our video version of this tutorial with step by step explanation.