mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 20:40:55 +00:00
asdasdasd
This commit is contained in:
1 parent
c4182ec609
commit
9905cde527
76 files changed
+2895
-2529
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using CartriX.Api.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CartriX.Api.Classes
|
||||
@@ -7,15 +8,18 @@ namespace CartriX.Api.Classes
|
||||
public AppDbContext(DbContextOptions options) : base(options) { }
|
||||
|
||||
public DbSet<Entities.Printer> Printers { get; set; }
|
||||
public DbSet<Entities.Article> Articles { get; set; }
|
||||
//public DbSet<Entities.PrinterArticle> PrinterArticles { get; set; }
|
||||
public DbSet<Entities.PrinterModel> PrinterModels { get; set; }
|
||||
public DbSet<Entities.CartridgeArticle> СartridgeArticles { get; set; }
|
||||
//public DbSet<Entities.CartridgeArticle> CartridgeArticles { get; set; }
|
||||
public DbSet<Entities.ConnetctionType> СonnetctionTypes { get; set; }
|
||||
public DbSet<Entities.Location> Locations { get; set; }
|
||||
public DbSet<Entities.Cartridge> Cartridges { get; set; }
|
||||
public DbSet<Entities.CartridgeModel> CartridgeModels { get; set; }
|
||||
public DbSet<Entities.PrintType> PrintTypes { get; set; }
|
||||
public DbSet<Entities.PrinterStatus> PrinterStatuses { get; set; }
|
||||
public DbSet<Entities.CartridgeStatus> CartridgeStatuses { get; set; }
|
||||
public DbSet<Entities.LogPrinter> LogPrinters { get; set; }
|
||||
public DbSet<Entities.PrinterCounterRecord> PrinterCounterRecord { get; set; }
|
||||
public DbSet<Entities.Manufacturer> Manufacturers { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
@@ -36,18 +40,21 @@ namespace CartriX.Api.Classes
|
||||
new Entities.CartridgeStatus { id = 4, name = "InlineRefilling" },
|
||||
new Entities.CartridgeStatus { id = 5, name = "UnderRepair" }
|
||||
);
|
||||
modelBuilder.Entity<Entities.PrinterStatus>().HasData(
|
||||
new Entities.PrinterStatus { id = 1, name = "Active" },
|
||||
new Entities.PrinterStatus { id = 2, name = "Unavailable" },
|
||||
new Entities.PrinterStatus { id = 3, name = "UnderRepair" }
|
||||
);
|
||||
modelBuilder.Entity<Entities.ConnetctionType>().HasData(
|
||||
new Entities.ConnetctionType { id = 1, name = "Network" },
|
||||
new Entities.ConnetctionType { id = 2, name = "USB" }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<Entities.Printer>().Property(p => p.oidForQueryCountPrintedAllTime).HasDefaultValue("1.3.6.1.2.1.43.10.2.1.4.1.1");
|
||||
|
||||
modelBuilder.Entity<Entities.Cartridge>().Property(p => p.statusId).HasDefaultValue("2");
|
||||
modelBuilder.Entity<Entities.Printer>().Property(p => p.statusId).HasDefaultValue("1");
|
||||
|
||||
modelBuilder.Entity<Entities.CartridgeArticle>()
|
||||
.HasMany(c => c.CartridgeModel)
|
||||
.WithMany(p => p.Articles)
|
||||
.UsingEntity(e => e.ToTable("printerModel_cartridgeArticles"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user