| | | 1 | | using Syki.Back.Domain.Institutions; |
| | | 2 | | |
| | | 3 | | namespace Syki.Back.Database.Institutions; |
| | | 4 | | |
| | | 5 | | public class InstitutionDbConfig : IEntityTypeConfiguration<Institution> |
| | | 6 | | { |
| | | 7 | | public void Configure(EntityTypeBuilder<Institution> entity) |
| | | 8 | | { |
| | 4 | 9 | | entity.ToTable("institutions", DbSchemas.Syki); |
| | | 10 | | |
| | 4 | 11 | | entity.HasKey(e => e.Id); |
| | | 12 | | |
| | 4 | 13 | | entity.HasMany(e => e.Campi) |
| | 4 | 14 | | .WithOne() |
| | 4 | 15 | | .HasForeignKey(c => c.InstitutionId); |
| | | 16 | | |
| | 4 | 17 | | entity.HasMany(e => e.Courses) |
| | 4 | 18 | | .WithOne() |
| | 4 | 19 | | .HasForeignKey(c => c.InstitutionId); |
| | | 20 | | |
| | 4 | 21 | | entity.HasMany(e => e.Users) |
| | 4 | 22 | | .WithOne(u => u.Institution) |
| | 4 | 23 | | .HasForeignKey(u => u.InstitutionId); |
| | | 24 | | |
| | 4 | 25 | | entity.HasMany(e => e.Students) |
| | 4 | 26 | | .WithOne() |
| | 4 | 27 | | .HasForeignKey(s => s.InstitutionId); |
| | | 28 | | |
| | 4 | 29 | | entity.HasMany(e => e.Teachers) |
| | 4 | 30 | | .WithOne() |
| | 4 | 31 | | .HasForeignKey(t => t.InstitutionId); |
| | | 32 | | |
| | 4 | 33 | | entity.HasMany(e => e.Disciplines) |
| | 4 | 34 | | .WithOne() |
| | 4 | 35 | | .HasForeignKey(d => d.InstitutionId); |
| | | 36 | | |
| | 4 | 37 | | entity.HasMany(e => e.CourseOfferings) |
| | 4 | 38 | | .WithOne() |
| | 4 | 39 | | .HasForeignKey(co => co.InstitutionId); |
| | | 40 | | |
| | 4 | 41 | | entity.HasMany(e => e.AcademicPeriods) |
| | 4 | 42 | | .WithOne() |
| | 4 | 43 | | .HasForeignKey(ap => ap.InstitutionId); |
| | | 44 | | |
| | 4 | 45 | | entity.HasMany(e => e.EnrollmentPeriods) |
| | 4 | 46 | | .WithOne() |
| | 4 | 47 | | .HasForeignKey(ep => ep.InstitutionId); |
| | | 48 | | |
| | 4 | 49 | | entity.HasMany(e => e.CourseCurriculums) |
| | 4 | 50 | | .WithOne() |
| | 4 | 51 | | .HasForeignKey(cc => cc.InstitutionId); |
| | 4 | 52 | | } |
| | | 53 | | } |