# TeacherHelp **Repository Path**: zhxd19/teacher-help ## Basic Information - **Project Name**: TeacherHelp - **Description**: 教师助手 - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-04 - **Last Updated**: 2025-06-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ** ### - 1.依次安装下列包 ** 1. Install-Package System.Data.SQLite 2. Install-Package System.Data.SQLite.EF6 3. Install-Package System.Data.SQLite.EF6.Migrations ### - 2. 配置连接字符串(App.config 或 Web.config) ### - 3.添加驱动 ### - 4. 创建 DbContext 和实体 using System.Data.Entity; public class MyEntity { public int Id { get; set; } public string Name { get; set; } } public class MyDbContext : DbContext { public MyDbContext() : base("name=MyDbContext") { // 确保 SQLite 提供程序已正确加载 System.Data.SQLite.SQLiteFactory.Instance.CreateConnection(); } public DbSet MyEntities { get; set; } } ### - 5.新建文件夹Migrations ,并且在此文件夹下添加Configuration.cs类 internal sealed class Configuration : DbMigrationsConfiguration { public Configuration() { AutomaticMigrationsEnabled = false; // 注册 SQLite 的 Migration SQL 生成器 SetSqlGenerator("System.Data.SQLite", new SQLiteMigrationSqlGenerator()); } } ### - 6. 启用迁移 Enable-Migrations(不可用) Add-Migration InitialCreate Update-Database