Asp.Net Core MVC CRUD Operation with EF Core

Hello friends In this article, we will learn how to do CRUD Operations in Asp.Net Core MVC Application with EF Core Code First Approach.

Create Asp.Net Core MVC Project

In Visual Studio 2019, Goto File > New > Project ( Ctrl + Shift + N). Then select Asp.Net Core Web Application.

CRUD Operation

Give project name Eg. CRUD_Operation

Give Project Name
Give Project Name

Database Setup for Entity Framework Core

For this application development, we will use Entity Framework Core – Code First Approach. First of all, we have to install NuGet Package for Entity Framework Core . for that you can right click on project in solution explorer, click on Manage NuGet Packages. In Browse tab, search for Microsoft.EntityFrameworkCore. Install the package with same version as that of Asp.Net Core.

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CRUD_Operation.Models
    public class SudentDbContext:DbContext
        public SudentDbContext(DbContextOptions options) : base(options)

        public DbSet Student { get; set; }

We will create the DBContext class inside Models folder. To demonstrate Asp.Net Core CRUD Operation, we will deal with Students Details like Full Name, Student Roll No,Class and Home Address. So that I have named this DbContext as SudentDbContext which is inherited with DbContext Class.

Leave a Reply

Your email address will not be published. Required fields are marked *