using EFCoreDatabase.Entities; using Microsoft.EntityFrameworkCore; namespace EFCoreDatabase.Data { public class DmDBContext:DbContext { public DmDBContext(DbContextOptions options) : base(options) { } public DbSet Manage_Main { get; set; } public DbSet Manage_List { get; set; } public DbSet Storage_Main { get; set; } public DbSet Storage_List { get; set; } public DbSet Wh_Cell { get; set; } public DbSet Io_Control_Routes { get; set; } public DbSet Io_Control { get; set; } public DbSet Reserve_Cell { get; set; } public DbSet Sys_Item { get; set; } public DbSet Sys_Item_List { get; set; } public DbSet Stacker_Crane_Status { get; set; } public DbSet Io_Control_Apply_His { get; set; } public DbSet Goods_Main { get; set; } public DbSet Plan_main { get; set; } public DbSet Plan_list { get; set; } public virtual DbSet V_Storage_List { get; set; } public virtual DbSet V_Manage { get; set; } public DbSet Wh_warehouse { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { //定义视图无主键 modelBuilder.Entity().HasNoKey(); modelBuilder.Entity().HasNoKey(); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_EMPTY_BUCKET).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_RUBBER).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.MANAGE_LIST_QUANTITY).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_EMPTY_BUCKET).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_RUBBER).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.STORAGE_LIST_QUANTITY).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_EMPTY_BUCKET).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.WEIGHT_RUBBER).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.MANAGE_LIST_QUANTITY).HasColumnType("decimal")); modelBuilder.Entity(x => x.Property(e => e.STORAGE_LIST_QUANTITY).HasColumnType("decimal")); //tlt添加序列和自增ID属性 modelBuilder.Entity().HasKey(x => x.GOODS_ID);//定义主键 modelBuilder.Entity().Property(e => e.GOODS_ID).UseHiLo("GOODS_MAIN_SEQ");//定义主键序列 modelBuilder.Entity().HasKey(x => x.PLAN_ID);//定义主键 modelBuilder.Entity().Property(e => e.PLAN_ID).UseHiLo("PLAN_MAIN_SEQ");//定义主键序列 modelBuilder.Entity().HasKey(x => x.PLAN_LIST_ID);//定义主键 modelBuilder.Entity().Property(e => e.PLAN_LIST_ID).UseHiLo("PLAN_LIST_SEQ");//定义主键序列 modelBuilder.Entity().HasKey(x => x.WAREHOUSE_ID);//定义主键 modelBuilder.Entity().Property(e => e.WAREHOUSE_ID).UseHiLo("WAREHOUSE_ID_SEQ");//定义主键序列 } } }