Files
maintenancepages/Data/GroupLookupDbContext.cs
T
2026-02-23 08:00:41 -05:00

47 lines
1.4 KiB
C#

using maintenance.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace maintenance.Data;
public sealed class GroupLookupDbContext : DbContext
{
public GroupLookupDbContext(DbContextOptions<GroupLookupDbContext> options) : base(options)
{
}
public DbSet<GroupLookupEntity> Groups => Set<GroupLookupEntity>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<GroupLookupEntity>(e =>
{
e.ToTable("GroupLookup");
e.HasKey(x => x.GroupClaimValue);
e.Property(x => x.GroupClaimValue).HasMaxLength(256).IsRequired();
e.Property(x => x.DisplayName).HasMaxLength(256).IsRequired();
});
}
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<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
public override Task<int> SaveChangesAsync(
bool acceptAllChangesOnSuccess,
CancellationToken cancellationToken = default)
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
}