Introduction to Entity Framework Core

Introduction to Entity Framework Core

Entity Framework Core also known as EF Core is the latest version of Microsoft’s Entity Framework. It is an Object Relational Mapping (O/RM) framework, an enhanced version of ADO.NET, that automates data storage and retrieval from the database. EF Core is open source, cross-platform, lightweight, extensible and very powerful in nature. It is also very easy to learn and use in our DOT NET Projects.

EF Core can be use with with any .NET applications. It runs on all OS – Windows, Mac, Linux.

EF Core Supported Application Types

We can use Entity Framework Core on all DOT NET applications like :

  1. Console Applications
  2. Windows Applications
  3. ASP.NET Web Forms
  4. ASP.NET MVC
  5. ASP.NET Core MVC
  6. ASP.NET Core Razor Pages
  7. Blazor Apps
  8. WPF
  9. Xamarin Framework.
  10. Web API
  11. .NET MAUI

EF Core Versions

EF Core Version Release Date
EF Core 6.0 December 2021
EF Core 5.0 November 2020
EF Core 3.1 December 2019
EF Core 2.0 August 2017
EF Core 1.1 November 2016
EF Core 1.0 June 2016
One of the most important topics of EF Core is DbContext Class in Entity Framework Core. Make sure to understand it fully else coding will become hard.

Entity Framework Core vs Entity Framework

Entity Framework Core is the highly enhanced version of Entity Framework and contains a lot more features. It was released in the year 2016 when DOT NET Core came into existence. Entity Framework has a visual designer tool called .edmx file which describes the database and the models along with the mappings between them. Entity Framework Core does not have a visual designer tool. All the models and mappings are created in C# classes. Entity Framework is no longer actively developed by Microsoft so use only Entity Framework Core in your projects.

Entity Framework Core Approaches

There are 2 Entity Framework Core develpment approaches which we can follow. These are:

  • 1. Database First .
  • 2. Code First.

There is very little support of Database First approach since there is no visual designer, like .edmx file, in EF Core. The EF Core mainly supports Code First approach.

Database First Approach

In Database First approach the domain & context classes are created based on the existing Database.

Code First Approach

In Code First approach the domain & context classes are created by you then EF Core created the database using these classes. The term Migration is used whenever EF Core creates or updates the Database based on the domain & context classes.

EF Core approaches

Entity Framework Core Features

Some important features of EF Core are:

  • 1. DbContext & DbSet
  • 2. LINQ Support
  • 3. Tracking
  • 4. Migrations
  • 5. Batch Insert, Update and Delete operations

Supported Databases

Entity Framework Core works on many databases like:

1. SQL Server
2. MySQL
3. PostgreSQL
4. SQLite
5. SQL Compact
6. Firebird
7. Oracle
8. Db2

In the text tutorial we will see about EF Core – Installation
Xaero – Entity Framework Core Advanced Project is my latest project where I have created a full Movie Database based ASP.NET Core App in Entity Framework Core. In this project you will find lots and lots of reusable high quality codes.

SHARE THIS ARTICLE

  • linkedin
  • reddit
yogihosting

ABOUT THE AUTHOR

I hope you enjoyed reading this tutorial. If it helped you then consider buying a cup of coffee for me. This will help me in writing more such good tutorials for the readers. Thank you. Buy Me A Coffee donate