Entity Framework core: Overview
To dive deep in make sure that you have basic knowledge about what is .net Framework and .net Core?
In this blog post, we will learn what is Entity framework and what is entity framework core? How both of them work?
What is an entity framework?
Entity Framework 1 was first introduced in 2008. The latest version is in 2019 is EF 6.3/6.4. The 6.3 is also used in the .NET Core based application. So, the next question which you have is if my application has a code in let’s say in EF 6.2, then can I migrate it. So yes, you can do it easily.
EF, helps in data manipulation API over mapped schema.And you just need to query the OBJECT. It uses the LINQ to query the database.
What is entity framework core?
Entity framework core 1.0/1.1, used in 2016. In 2019 EF 3.0/3.1 was released. The upcoming version is 5.0.
The term entity framework core is a cross-platform, open-source, object-relation mapper, lightweight, extensible version of entity framework. The EF Core is written from scratch to query data in the cross-platform environment.
Using it we can perform the query operation in object-oriented form. It can access many databases, and as a word cross-platform so, you can run them in Linux, Windows, Ubuntu.
You can access them by using a plugin library named database provider. While using/working with Provider, make sure that you have gone through the used provider’s documentation in which you can go through the version details, licensing, compatibility, and many more.
You can add the database provider to your application by the code as shown below.
1) If you are using visual studio then use “install-package provider_package_name”
2) If you are using .NET Core CLI then use ”dotnet add package provider_package_name”
EF Core is mainly related to ORM, so let’s understand it in detail. Let’s start hunting.
What are the benefits of Entity framework core?
EF Core helps to map database tables to classes and objects. The tables which we have inside the database, we can easily map them with the classes. It provides type safety as compile-time, which means the value assigned to the query parameter, that datatypes are going to be checked at compile time.
In the upcoming blog post we will discuss about code-first and database-first approach. That means it is not support EDMX/XML based modeling, No model first approach.
Time is saved just because you don’t need to write the SQL query, also supports NoSQL Database
How .net ORM Tools help in programming?
If you are using .net based application then either your application uses CORE or not use Core. If your application is based on a .NET framework 4.X based application then at that time you suppose to use EF 6.X, and if your application is based on a .NET Core application then use EF Core.
If you have different database like MariaDB, DB2, MySQL etc. then you can use EF Core. We have already discussed about database provider.