From 40279ab2b8ea0606a844cf29294fd25247c46711 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Mon, 8 Jan 2024 16:51:57 +0300 Subject: [PATCH] feat: add a data context --- .../Contexts/Schedule/CampusDbContext.cs | 17 +++++++++++++++++ Persistence/Contexts/Schedule/DayDbContext.cs | 17 +++++++++++++++++ .../Contexts/Schedule/FacultyDbContext.cs | 17 +++++++++++++++++ Persistence/Contexts/Schedule/GroupDbContext.cs | 17 +++++++++++++++++ .../Contexts/Schedule/LectureHallDbContext.cs | 17 +++++++++++++++++ .../Contexts/Schedule/LessonDbContext.cs | 17 +++++++++++++++++ .../LessonToTypeOfOccupationDbContext.cs | 17 +++++++++++++++++ .../Contexts/Schedule/ProfessorDbContext.cs | 17 +++++++++++++++++ .../Schedule/ProfessorToLessonDbContext.cs | 17 +++++++++++++++++ .../Schedule/TypeOfOccupationDbContext.cs | 17 +++++++++++++++++ 10 files changed, 170 insertions(+) create mode 100644 Persistence/Contexts/Schedule/CampusDbContext.cs create mode 100644 Persistence/Contexts/Schedule/DayDbContext.cs create mode 100644 Persistence/Contexts/Schedule/FacultyDbContext.cs create mode 100644 Persistence/Contexts/Schedule/GroupDbContext.cs create mode 100644 Persistence/Contexts/Schedule/LectureHallDbContext.cs create mode 100644 Persistence/Contexts/Schedule/LessonDbContext.cs create mode 100644 Persistence/Contexts/Schedule/LessonToTypeOfOccupationDbContext.cs create mode 100644 Persistence/Contexts/Schedule/ProfessorDbContext.cs create mode 100644 Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs create mode 100644 Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs diff --git a/Persistence/Contexts/Schedule/CampusDbContext.cs b/Persistence/Contexts/Schedule/CampusDbContext.cs new file mode 100644 index 0000000..30a9d56 --- /dev/null +++ b/Persistence/Contexts/Schedule/CampusDbContext.cs @@ -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 options) : DbContext(options), ICampusDbContext +{ + public DbSet Campuses { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new CampusConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/DayDbContext.cs b/Persistence/Contexts/Schedule/DayDbContext.cs new file mode 100644 index 0000000..2edbb3a --- /dev/null +++ b/Persistence/Contexts/Schedule/DayDbContext.cs @@ -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 options) : DbContext(options), IDayDbContext +{ + public DbSet Days { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new DayConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/FacultyDbContext.cs b/Persistence/Contexts/Schedule/FacultyDbContext.cs new file mode 100644 index 0000000..ab6a45c --- /dev/null +++ b/Persistence/Contexts/Schedule/FacultyDbContext.cs @@ -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 options) : DbContext(options), IFacultyDbContext +{ + public DbSet Faculties { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new FacultyConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/GroupDbContext.cs b/Persistence/Contexts/Schedule/GroupDbContext.cs new file mode 100644 index 0000000..5d61c70 --- /dev/null +++ b/Persistence/Contexts/Schedule/GroupDbContext.cs @@ -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 options) : DbContext(options), IGroupDbContext +{ + public DbSet Groups { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new GroupConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/LectureHallDbContext.cs b/Persistence/Contexts/Schedule/LectureHallDbContext.cs new file mode 100644 index 0000000..67841a1 --- /dev/null +++ b/Persistence/Contexts/Schedule/LectureHallDbContext.cs @@ -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 options) : DbContext(options), ILectureHallDbContext +{ + public DbSet LectureHalls { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new LectureHallConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/LessonDbContext.cs b/Persistence/Contexts/Schedule/LessonDbContext.cs new file mode 100644 index 0000000..d2dfcae --- /dev/null +++ b/Persistence/Contexts/Schedule/LessonDbContext.cs @@ -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 options) : DbContext(options), ILessonDbContext +{ + public DbSet Lessons { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new LessonConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/LessonToTypeOfOccupationDbContext.cs b/Persistence/Contexts/Schedule/LessonToTypeOfOccupationDbContext.cs new file mode 100644 index 0000000..1aada5e --- /dev/null +++ b/Persistence/Contexts/Schedule/LessonToTypeOfOccupationDbContext.cs @@ -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 options) : DbContext(options), ILessonToTypeOfOccupationDbContext +{ + public DbSet LessonToTypeOfOccupations { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new LessonToTypeOfOccupationConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/ProfessorDbContext.cs b/Persistence/Contexts/Schedule/ProfessorDbContext.cs new file mode 100644 index 0000000..fcd51c6 --- /dev/null +++ b/Persistence/Contexts/Schedule/ProfessorDbContext.cs @@ -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 options) : DbContext(options), IProfessorDbContext +{ + public DbSet Professors { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new ProfessorConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs b/Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs new file mode 100644 index 0000000..1673b68 --- /dev/null +++ b/Persistence/Contexts/Schedule/ProfessorToLessonDbContext.cs @@ -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 options) : DbContext(options), IProfessorToLessonDbContext +{ + public DbSet ProfessorToLessons { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new ProfessorToLessonConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file diff --git a/Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs b/Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs new file mode 100644 index 0000000..b47ac61 --- /dev/null +++ b/Persistence/Contexts/Schedule/TypeOfOccupationDbContext.cs @@ -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 options) : DbContext(options), ITypeOfOccupationDbContext +{ + public DbSet TypeOfOccupations { get; set; } = null!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfiguration(new TypeOfOccupationConfiguration()); + base.OnModelCreating(modelBuilder); + } +} \ No newline at end of file