refactor: use wrap DbContext for UberDbContext

This commit is contained in:
Polianin Nikita 2024-05-30 20:12:36 +03:00
parent 43b6ab7934
commit 31c36443e1

View File

@ -1,10 +1,11 @@
using Microsoft.EntityFrameworkCore;
using Mirea.Api.DataAccess.Domain.Schedule;
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
using Mirea.Api.DataAccess.Persistence.Common;
using System.Reflection;
namespace Mirea.Api.DataAccess.Persistence;
public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(options)
public class UberDbContext(DbContextOptions<UberDbContext> options) : BaseDbContext<UberDbContext>(options)
{
public DbSet<Campus> Campuses { get; set; } = null!;
public DbSet<Discipline> Disciplines { get; set; } = null!;
@ -19,17 +20,7 @@ public class UberDbContext(DbContextOptions<UberDbContext> options) : DbContext(
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new CampusConfiguration());
modelBuilder.ApplyConfiguration(new DisciplineConfiguration());
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
modelBuilder.ApplyConfiguration(new GroupConfiguration());
modelBuilder.ApplyConfiguration(new LectureHallConfiguration());
modelBuilder.ApplyConfiguration(new LessonConfiguration());
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
modelBuilder.ApplyConfiguration(new SpecificWeekConfiguration());
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
base.OnModelCreating(modelBuilder);
}
}