Note: See CRUD operations application for ASP.NET MVC 5 and Entity Framework 6.


A Visual Studio 2015 project which shows how to use the Entity Framework Core in an ASP.NET Core web application project, using the Code First development approach.

The code illustrates the following topics:

Getting Started

To build and run this sample as-is, you must have Visual Studio 2015 installed. In most cases you can run the application by following these steps:

  1. Download and extract the .zip file.
  2. Open the solution file in Visual Studio 2015.
  3. Change connection string in the appsettings.json file.
  4. Run the following command for migration and create database.
    Tools –> NuGet Package Manager –> Package Manager Console
    PM> Add-Migration MyFirstMigration
    PM> Update-Database
  5. Run the application.

Running the Sample

To run the sample, hit F5 or choose the Debug | Start Debugging menu command. You will see the customer list screen. From this screen you have customer listing screen as shown in below figure.

Figure 1: Customer Listing

You can add new customer using the Add Customer button. You can edit individual customer using edit button in listing as shown in below figure.

Figure 2: Edit Customer

Now you can delete individual customer using delete button in listing as shown in below figure.

Figure 3: Delete Customer

Source Code Overview

Most of folders play same role as in MVC application but there are following more folder and files.

  1. wwwroot: It holds static js and css files.
  2. DbEntities: It holds DbContext and Entities to perform database operations.
  3. bundleconfig.json: It holds bundling and minification files information.
  4. project.json: It holds database connection string.
  5. Migrations: It holds database migration files.