diff --git a/SqlData/Persistence/UberDbContext.cs b/SqlData/Persistence/UberDbContext.cs index ccd1877..3777ef2 100644 --- a/SqlData/Persistence/UberDbContext.cs +++ b/SqlData/Persistence/UberDbContext.cs @@ -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 options) : DbContext(options) +public class UberDbContext(DbContextOptions options) : BaseDbContext(options) { public DbSet Campuses { get; set; } = null!; public DbSet Disciplines { get; set; } = null!; @@ -19,17 +20,7 @@ public class UberDbContext(DbContextOptions 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); } } \ No newline at end of file