Sunday, October 25, 2020

How to Add Entity Framework Core Code First to your ASP.NET Core 3.1 Application

In this tutorial, we will show you how to add Entity Framework Core Code First to your ASP.NET Core 3.1 Application.

Step #1: First, create a new ASP.NET Core Web Application In Visual Studio 2019 as shown below.



Step #2: Add the following Packages to your application.

Step #3: Create a Model, which will be then used to create table in your database.

Step #4: Add a Context class to your application


Step #5
: Add Connection String to appsettings.json



Step #6
: Add the following Middleware in the startup.cs class.


Step #7
: Add Migration and Update Database


Happy Coding.

No comments:

Post a Comment