refactor: use wrap DbContext for UberDbContext
This commit is contained in:
parent
43b6ab7934
commit
31c36443e1
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user