feat: add a data context
This commit is contained in:
parent
cb55567519
commit
40279ab2b8
17
Persistence/Contexts/Schedule/CampusDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/CampusDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class CampusDbContext(DbContextOptions<CampusDbContext> options) : DbContext(options), ICampusDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Campus> Campuses { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new CampusConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/DayDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/DayDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class DayDbContext(DbContextOptions<DayDbContext> options) : DbContext(options), IDayDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Day> Days { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new DayConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/FacultyDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/FacultyDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class FacultyDbContext(DbContextOptions<FacultyDbContext> options) : DbContext(options), IFacultyDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Faculty> Faculties { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/GroupDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/GroupDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class GroupDbContext(DbContextOptions<GroupDbContext> options) : DbContext(options), IGroupDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Group> Groups { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new GroupConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/LectureHallDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/LectureHallDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class LectureHallDbContext(DbContextOptions<LectureHallDbContext> options) : DbContext(options), ILectureHallDbContext
|
||||||
|
{
|
||||||
|
public DbSet<LectureHall> LectureHalls { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new LectureHallConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/LessonDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/LessonDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class LessonDbContext(DbContextOptions<LessonDbContext> options) : DbContext(options), ILessonDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Lesson> Lessons { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new LessonConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class LessonToTypeOfOccupationDbContext(DbContextOptions<LessonToTypeOfOccupationDbContext> options) : DbContext(options), ILessonToTypeOfOccupationDbContext
|
||||||
|
{
|
||||||
|
public DbSet<LessonToTypeOfOccupation> LessonToTypeOfOccupations { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/ProfessorDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/ProfessorDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class ProfessorDbContext(DbContextOptions<ProfessorDbContext> options) : DbContext(options), IProfessorDbContext
|
||||||
|
{
|
||||||
|
public DbSet<Professor> Professors { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new ProfessorConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class ProfessorToLessonDbContext(DbContextOptions<ProfessorToLessonDbContext> options) : DbContext(options), IProfessorToLessonDbContext
|
||||||
|
{
|
||||||
|
public DbSet<ProfessorToLesson> ProfessorToLessons { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
17
Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs
Normal file
17
Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||||
|
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||||
|
|
||||||
|
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||||
|
|
||||||
|
public class TypeOfOccupationDbContext(DbContextOptions<TypeOfOccupationDbContext> options) : DbContext(options), ITypeOfOccupationDbContext
|
||||||
|
{
|
||||||
|
public DbSet<TypeOfOccupation> TypeOfOccupations { get; set; } = null!;
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration());
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user