Setting up a database, EF Core, and DbContext
You often require a persistence framework, a middleware that helps developers store data in a database if there's a requirement to access a database in our application. Using a persistence framework, you can easily use your entities to query or save objects to a database. Now let's look at what EF Core and DbContext
are.
EF Core
In ASP.NET Core, you can build a persistence framework from scratch, but you don't have to because it is time-consuming and expensive. Why? Writing many stored procedures is hard to maintain; reading data through ADO.NET objects then mapping them to your tables in your application is painful.
So, here comes Entity Framework to the rescue. Entity Framework is a persistence framework that does all the plumbing for you. Typically, you don't need to write any store procedures or map tables to your entities.
So what is EF Core? EF Core is a cross-platform object-relational mapper (O/RM...