ABP Development Notes 7-- update the database infrastructure layer

Click here to enter the ABP Development Notes directory 

Setting up the database

Open the database environment set up infrastructure layer (ie JD.CRS.EntityFrameworkCore)

JD.CRS.EntityFrameworkCore / EntityFrameworkCore / CRSDbContext.cs
add a line

public DbSet <Course> Course {get; set;} // create a data table Course

 1 using Microsoft.EntityFrameworkCore;
 2 using Abp.Zero.EntityFrameworkCore;
 3 using JD.CRS.Authorization.Roles;
 4 using JD.CRS.Authorization.Users;
 5 using JD.CRS.MultiTenancy;
 6 using JD.CRS.Entitys;
 7 
 8 namespace JD.CRS.EntityFrameworkCore
 9 {
10     public class CRSDbContext : AbpZeroDbContext<Tenant, Role, User, CRSDbContext>
11     {
12         /* Define a DbSet for each entity of the application */
13         
14         public CRSDbContext(DbContextOptions<CRSDbContext> options)
15             : base(options)
16         {
17         }
18 
19         public DbSet<Course> Course { get; set; }
20     
21     }
22 }
Class CRSDbContext

Update the database

Open the Tools / NuGet Package Manager / Package Manager Console

The default project selection JD.CRS.EntityFrameworkCore

Sequentially executing the following command to
the Add-Migration 'addCourse'
the Update Database--Verbose

View database

Open MS SQL Server, you can see the new table Course.

 

Guess you like

Origin www.cnblogs.com/IT-Evan/p/ABP7.html