using Microsoft.EntityFrameworkCore; using CartriX.Shared.Models; namespace CartriX.Shared.Classes { public class AppDbContext : DbContext { public AppDbContext(DbContextOptions options) : base(options) { } public DbSet Printers { get; set; } public DbSet PrinterModels { get; set; } public DbSet Locations { get; set; } public DbSet Cartridges { get; set; } public DbSet CartridgeModels { get; set; } public DbSet PrintTypes { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasIndex(l => l.name).IsUnique(); modelBuilder.Entity().HasData( new PrintType { id = 1, name = "Laser" }, new PrintType { id = 2, name = "Inkjet" } ); base.OnModelCreating(modelBuilder); } } }