You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Data.Entity;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Ksat.Supplyment.Library.Model
|
|
|
|
|
{
|
|
|
|
|
public class CodeFirstDbContext : DbContext
|
|
|
|
|
{
|
|
|
|
|
//您的上下文已配置为从您的应用程序的配置文件(App.config 或 Web.config)
|
|
|
|
|
//使用“CodeFirstDbContext”连接字符串。默认情况下,此连接字符串针对您的 LocalDb 实例上的
|
|
|
|
|
//“Ksat.Supplyment.Library.Model.CodeFirstDbContext”数据库。
|
|
|
|
|
//
|
|
|
|
|
//如果您想要针对其他数据库和/或数据库提供程序,请在应用程序配置文件中修改“CodeFirstDbContext”
|
|
|
|
|
//连接字符串。
|
|
|
|
|
public CodeFirstDbContext() : base(@"name = sqlite")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
modelBuilder.Entity<Model.Uploader.UploadCache>().ToTable("UploadCaches").HasKey(p => p.Id);
|
|
|
|
|
modelBuilder.Entity<Model.Uploader.UploadCancel>().ToTable("UploadCancels").HasKey(p => p.Id);
|
|
|
|
|
modelBuilder.Entity<Model.Uploader.UploadFinish>().ToTable("UploadFinishs").HasKey(p => p.Id);
|
|
|
|
|
Database.SetInitializer(new SQLite.CodeFirst.SqliteCreateDatabaseIfNotExists<CodeFirstDbContext>(modelBuilder));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//为您要在模型中包含的每种实体类型都添加 DbSet。有关配置和使用 Code First 模型
|
|
|
|
|
//的详细信息,请参阅 https://blog.csdn.net/wucdsg/article/details/78895366
|
|
|
|
|
public virtual DbSet<Model.Uploader.UploadCache> UploadCaches { get; set; }
|
|
|
|
|
public virtual DbSet<Model.Uploader.UploadCancel> UploadCancels { get; set; }
|
|
|
|
|
public virtual DbSet<Model.Uploader.UploadFinish> UploadFinishs { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public class MyEntity
|
|
|
|
|
//{
|
|
|
|
|
// public int Id { get; set; }
|
|
|
|
|
// public string Name { get; set; }
|
|
|
|
|
//}
|
|
|
|
|
}
|