| | 1 | | using Syki.Back.Features.Academic.CreateCampus; |
| | 2 | | using Syki.Back.Features.Student.CreateStudentEnrollment; |
| | 3 | |
|
| | 4 | | namespace Syki.Back.Features.Academic.CreateClass; |
| | 5 | |
|
| | 6 | | public class ClassConfig : IEntityTypeConfiguration<Class> |
| | 7 | | { |
| | 8 | | public void Configure(EntityTypeBuilder<Class> @class) |
| | 9 | | { |
| 2 | 10 | | @class.ToTable("classes"); |
| | 11 | |
|
| 2 | 12 | | @class.HasKey(c => c.Id); |
| 2 | 13 | | @class.Property(c => c.Id).ValueGeneratedNever(); |
| | 14 | |
|
| 2 | 15 | | @class.HasOne<Campus>() |
| 2 | 16 | | .WithMany() |
| 2 | 17 | | .HasForeignKey(c => c.CampusId); |
| | 18 | |
|
| 2 | 19 | | @class.HasOne(c => c.Teacher) |
| 2 | 20 | | .WithMany() |
| 2 | 21 | | .HasForeignKey(c => c.TeacherId); |
| | 22 | |
|
| 2 | 23 | | @class.HasOne(c => c.Discipline) |
| 2 | 24 | | .WithMany() |
| 2 | 25 | | .HasForeignKey(c => c.DisciplineId); |
| | 26 | |
|
| 2 | 27 | | @class.HasMany(c => c.Schedules) |
| 2 | 28 | | .WithOne() |
| 2 | 29 | | .HasForeignKey(s => s.ClassId); |
| | 30 | |
|
| 2 | 31 | | @class.HasMany(c => c.Lessons) |
| 2 | 32 | | .WithOne() |
| 2 | 33 | | .HasForeignKey(l => l.ClassId); |
| | 34 | |
|
| 2 | 35 | | @class.HasMany(c => c.Activities) |
| 2 | 36 | | .WithOne() |
| 2 | 37 | | .HasForeignKey(a => a.ClassId); |
| | 38 | |
|
| 2 | 39 | | @class.HasOne(c => c.Period) |
| 2 | 40 | | .WithMany() |
| 2 | 41 | | .HasForeignKey(c => new { c.PeriodId, c.InstitutionId }); |
| | 42 | |
|
| 2 | 43 | | @class.HasMany(c => c.Notes) |
| 2 | 44 | | .WithOne() |
| 2 | 45 | | .HasForeignKey(eg => eg.ClassId); |
| | 46 | |
|
| 2 | 47 | | @class.HasMany(c => c.Students) |
| 2 | 48 | | .WithMany() |
| 2 | 49 | | .UsingEntity<ClassStudent>(); |
| | 50 | |
|
| 2 | 51 | | @class.Ignore(c => c.FillRatio); |
| 2 | 52 | | } |
| | 53 | | } |