Introduction to Entity Framework Core
Entity Framework (EF) Core is a lightweight, extensible, open-source, and cross-platform version of the popular Entity Framework data access technology. EF Core can serve as an object-relational mapper (ORM), enabling .NET developers to work with a database using .NET objects, and eliminating the need for most of the data-access code they usually need to write. EF Core supports many database engines. In this article, I will teach you how to connect with SQL Server from ASP.NET MVC using Entity Framework Core.
Before we dive deep into the lesson I want to teach you some basics. It’s better to have some basic understanding of these things to understand the bigger picture that we are going to learn.
Object Relational Mapper (ORM)
The ORM frameworks generate objects (as in Object Oriented Programming) that virtually map the tables in a database. Then the programmer uses these objects to interact with the database. So the main idea is to try and shield the programmer from having to write optimized SQL code. For example, we are writing an application in C# and our database is in SQL. They are different platforms and have different formats right. How can they communicate with each other then? We need middleware to connect these two. ORM automatically maps data with the relevant classes in the program when we are trying to retrieve the data from the database or else to insert the object that we created to the database it will automatically translate to the code that SQL understands and add it to the…