using DeviceDatabaseImplement.Models; using Microsoft.EntityFrameworkCore; namespace DeviceDatabaseImplement { public class DeviceDatabase : DbContext { protected override void OnConfiguring( DbContextOptionsBuilder optionsBuilder) { if (optionsBuilder.IsConfigured == false) { optionsBuilder.UseSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ConfectioneryDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasKey(sc => new { sc.StaffId, sc.KitId }); } public virtual DbSet Cabinets { set; get; } public virtual DbSet Devices { set; get; } public virtual DbSet Kinds { set; get; } public virtual DbSet Kits { set; get; } public virtual DbSet Services { set; get; } public virtual DbSet Staff { set; get; } public virtual DbSet Ownership { set; get; } } }