| | | 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.Campus) |
| | 2 | 16 | | .WithMany() |
| | 2 | 17 | | .HasForeignKey(o => o.CampusId); |
| | | 18 | | |
| | 2 | 19 | | courseOffering.HasOne(o => o.Course) |
| | 2 | 20 | | .WithMany() |
| | 2 | 21 | | .HasForeignKey(o => o.CourseId); |
| | | 22 | | |
| | 2 | 23 | | courseOffering.HasOne(o => o.CourseCurriculum) |
| | 2 | 24 | | .WithMany() |
| | 2 | 25 | | .HasForeignKey(o => o.CourseCurriculumId); |
| | | 26 | | |
| | 2 | 27 | | courseOffering.HasOne<AcademicPeriod>() |
| | 2 | 28 | | .WithMany() |
| | 2 | 29 | | .HasForeignKey(o => new { o.Period, o.InstitutionId }); |
| | 2 | 30 | | } |
| | | 31 | | } |