MireaBackend/Persistence/UberDbContext.cs

33 lines
1.6 KiB
C#
Raw Permalink Normal View History

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<UberDbContext> options) : DbContext(options)
{
2024-01-26 07:43:27 +03:00
public DbSet<Campus> Campuses { get; set; } = null!;
public DbSet<Discipline> Disciplines { get; set; } = null!;
public DbSet<Faculty> Faculties { get; set; } = null!;
public DbSet<Group> Groups { get; set; } = null!;
public DbSet<LectureHall> LectureHalls { get; set; } = null!;
2024-01-26 07:43:27 +03:00
public DbSet<LessonAssociation> LessonAssociations { get; set; } = null!;
public DbSet<Lesson> Lessons { get; set; } = null!;
public DbSet<Professor> Professors { get; set; } = null!;
public DbSet<TypeOfOccupation> TypeOfOccupations { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
2024-01-26 07:43:27 +03:00
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());
2024-01-26 07:43:27 +03:00
modelBuilder.ApplyConfiguration(new LessonAssociationConfiguration());
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
base.OnModelCreating(modelBuilder);
}
}