Defining the database context class

In both Visual Studio 2017 and Visual Studio Code, in the NorthwindContextLib project, rename the Class1.cs class file as Northwind.cs.

Northwind.cs should look like this:

using Microsoft.EntityFrameworkCore;namespace Packt.CS7{  public class Northwind : DbContext  {     public DbSet<Category> Categories { get; set; }     public DbSet<Customer> Customers { get; set; }     public DbSet<Employee> Employees { get; set; }     public DbSet<Order> Orders { get; set; }     public DbSet<OrderDetail> OrderDetails { get; set; }     public DbSet<Product> Products { get; set; }     public DbSet<Shipper> Shippers { get; set; }     public DbSet<Supplier> Suppliers { get; set; }     public Northwind(DbContextOptions options)         : base(options) { } protected ...

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.