标签:文件 red too protected cte span 工程 包管理 model
创建控制台core3.0版
vs里引入
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Sqlite
包管理控制台
Scaffold-DbContext ’Data Source=testDb.db’ Microsoft.EntityFrameworkCore.Sqlite
会自动生成文件
public partial class testDbContext : DbContext { public testDbContext() { } public testDbContext(DbContextOptions<testDbContext> options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlite("Data Source=testDb.db"); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); }
标签:文件 red too protected cte span 工程 包管理 model
原文地址:https://www.cnblogs.com/buchizaodian/p/11946235.html