using maintenance.Data.Entities; using Microsoft.EntityFrameworkCore; namespace maintenance.Data; public sealed class GroupLookupDbContext : DbContext { public GroupLookupDbContext(DbContextOptions options) : base(options) { } public DbSet Groups => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(e => { e.ToTable("EmployeeGroup"); e.HasKey(x => x.Id); e.Property(x => x.Id).ValueGeneratedNever(); e.Property(x => x.Name).HasMaxLength(256).IsRequired(); e.Property(x => x.EmployeeId).IsRequired(); e.HasIndex(x => x.Name); }); } public override int SaveChanges() { throw new NotSupportedException("GroupLookupDbContext is read-only."); } public override int SaveChanges(bool acceptAllChangesOnSuccess) { throw new NotSupportedException("GroupLookupDbContext is read-only."); } public override Task SaveChangesAsync(CancellationToken cancellationToken = default) { throw new NotSupportedException("GroupLookupDbContext is read-only."); } public override Task SaveChangesAsync( bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) { throw new NotSupportedException("GroupLookupDbContext is read-only."); } }