时间:2021-07-01 10:21:17 帮助过:24人阅读
包管理控制台
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); }
C#连sqlite
标签:文件 red too protected cte span 工程 包管理 model