Introduction Of The Entity Framework Core 6.0

Introduction

In this article, I am going to introduce a few important components of the Entity Framework Core 6.0. This article can be used by beginners, intermediates, and professionals.

We will cover

  1. What is Entity Framework Core?
  2. Domain Classes
  3. Types of Entity Framework Core?
    • Code First Approach
    • Database Approach
  4. EF Core Data Provider 

Prerequisites

  1. Basic understanding of ORM (Object Relational Mapper)

What is Entity Framework Core?

Entity framework core is completely rewritten modern Object Relational Mapper (ORM) for .Net - Data Access Platform. 

EF Core 6.0 is the latest version. Next Entity Framework Core version EF Core 7.0 will be released on Nov-2022.

EF core is Microsoft's official Data access platform. 

Let’s see the below diagram, 

Entity Framework Core 6.0

As per the above images, we can say the definition would be,

“EF core is Lightweight, Extensible, Cross Platform and Opensource ORM framework introduced by Microsoft.”

The first concept would be “Domain Classes”

Domain Classes

In our application, we usually write classes like Employee, Customer, Member, and Courses for CRUD operations. These classes are called Domain Classes. 

Without ORM, we will need to write a lot of code to implement the CRUD operations or map data after received from the Database. 

In the EF Core, Domain classes can be used in Code First Approach and DB First Approach. Db First Approach has limited access to EF Core.

Entity Framework Core 6.0

Type of Entity Framework Core

EF Core has two types of approaches,

1. Code First Approach 

Code First Approach works based on Domain Driven Design.

Code First Approach

In Code First approach,

  1. Create Domain Classes.
  2. Create DB Context class derived from EF Core Db context classes.
  3. EF Core creates Db and Tables using a default configuration.
  4. You can change the EF Core default configuration. We will see this in upcoming articles.

2. Database First Approach

Database First Approach

The database approach will help us to create Domain classes and DB Context classes from an existing database using EF Core. It means, if you have an existing Database then we should use this approach to work with ORM.

What you will do if you have a different type of relation or non-relation database?

The answer is EF Core Database Provider.

EF Core Database Provider

EF Core provided a wide range of libraries to support various relational or non-relation databases. These libraries are available in form of Nuget packages. We need to download and install the NuGet package as per your database.

Please see the below link to get a list of EF Core Data Providers,

https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli

EF Core provider sits in between EF Core and Databases. 

Let’s see the below diagram,

EF Core Database Provider

This article gives you overview of the important components of the Entity Framework Core. We will have more discussions in the upcoming articles.

Hope you enjoyed it.

Recommended Ebook

Diving Into Microsoft .NET Entity Framework

Download Now!
Similar Articles