Use the configuration depending on the selected database provider #13

Merged
Wesser merged 33 commits from feat/database-persistence into feat/add-setup 2024-06-01 05:45:18 +03:00
Showing only changes of commit 31c36443e1 - Show all commits

View File

@ -1,10 +1,11 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Mirea.Api.DataAccess.Domain.Schedule; 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; 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<Campus> Campuses { get; set; } = null!;
public DbSet<Discipline> Disciplines { 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) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
modelBuilder.ApplyConfiguration(new CampusConfiguration()); modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
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());
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
} }
} }