| | 1 | | using Syki.Back.Features.Academic.CreateStudent; |
| | 2 | | using Syki.Back.Features.Academic.CreateAcademicPeriod; |
| | 3 | |
|
| | 4 | | namespace Syki.Back.Features.Academic.CreateCourseOffering; |
| | 5 | |
|
| | 6 | | public class OfertaConfig : IEntityTypeConfiguration<CourseOffering> |
| | 7 | | { |
| | 8 | | public void Configure(EntityTypeBuilder<CourseOffering> courseOffering) |
| | 9 | | { |
| 2 | 10 | | courseOffering.ToTable("course_offerings"); |
| | 11 | |
|
| 2 | 12 | | courseOffering.HasKey(o => o.Id); |
| 2 | 13 | | courseOffering.Property(o => o.Id).ValueGeneratedNever(); |
| | 14 | |
|
| 2 | 15 | | courseOffering.HasOne(o => o.Course) |
| 2 | 16 | | .WithMany() |
| 2 | 17 | | .HasForeignKey(o => o.CourseId); |
| | 18 | |
|
| 2 | 19 | | courseOffering.HasOne(o => o.CourseCurriculum) |
| 2 | 20 | | .WithMany() |
| 2 | 21 | | .HasForeignKey(o => o.CourseCurriculumId); |
| | 22 | |
|
| 2 | 23 | | courseOffering.HasOne<AcademicPeriod>() |
| 2 | 24 | | .WithMany() |
| 2 | 25 | | .HasForeignKey(o => new { o.Period, o.InstitutionId }); |
| | 26 | |
|
| 2 | 27 | | courseOffering.HasMany<SykiStudent>() |
| 2 | 28 | | .WithOne(a => a.CourseOffering) |
| 2 | 29 | | .HasForeignKey(a => a.CourseOfferingId); |
| 2 | 30 | | } |
| | 31 | | } |