diff --git a/Persistence/UberDbContext.cs b/Persistence/UberDbContext.cs new file mode 100644 index 0000000..17a4c52 --- /dev/null +++ b/Persistence/UberDbContext.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore; +using Mirea.Api.DataAccess.Domain.Schedule; +using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule; + +namespace Mirea.Api.DataAccess.Persistence; + +public class UberDbContext(DbContextOptions options) : DbContext(options) +{ + public DbSet Days { get; set; } = null!; + public DbSet Groups { get; set; } = null!; + public DbSet LectureHalls { get; set; } = null!; + public DbSet Lessons { get; set; } = null!; + public DbSet Professors { get; set; } = null!; + public DbSet TypeOfOccupations { get; set; } = null!; + public DbSet Faculties { get; set; } = null!; + public DbSet Campuses { get; set; } = null!; + public DbSet ProfessorToLessons { get; set; } = null!; + public DbSet LessonToTypeOfOccupations { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new DayConfiguration()); + modelBuilder.ApplyConfiguration(new GroupConfiguration()); + modelBuilder.ApplyConfiguration(new LectureHallConfiguration()); + modelBuilder.ApplyConfiguration(new LessonConfiguration()); + modelBuilder.ApplyConfiguration(new ProfessorConfiguration()); + modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration()); + modelBuilder.ApplyConfiguration(new FacultyConfiguration()); + modelBuilder.ApplyConfiguration(new CampusConfiguration()); + modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration()); + modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration()); + + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file