当前位置:Gxlcms > 数据库问题 > ABP开发手记7 - 基础设施层更新数据库

ABP开发手记7 - 基础设施层更新数据库

时间:2021-07-01 10:21:17 帮助过:29人阅读

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

更新数据库

打开工具 / NuGet包管理器 / 程序包管理器控制台

默认项目选择JD.CRS.EntityFrameworkCore

依次执行以下命令即可
Add-Migration ‘AddCourse‘
Update-Database -Verbose

查看数据库

打开MS SQL Server,可以看到新增的表Course.

技术图片

 

ABP开发手记7 - 基础设施层更新数据库

标签:选择   ram   png   migration   none   author   创建   控制台   onclick   

人气教程排行