| | 1 | | using Syki.Back.Features.Cross.CreateUser; |
| | 2 | |
|
| | 3 | | namespace Syki.Back.Features.Academic.CreateStudent; |
| | 4 | |
|
| | 5 | | public class SykiStudentConfig : IEntityTypeConfiguration<SykiStudent> |
| | 6 | | { |
| | 7 | | public void Configure(EntityTypeBuilder<SykiStudent> student) |
| | 8 | | { |
| 2 | 9 | | student.ToTable("students"); |
| | 10 | |
|
| 2 | 11 | | student.HasKey(a => a.Id); |
| 2 | 12 | | student.Property(a => a.Id).ValueGeneratedNever(); |
| | 13 | |
|
| 2 | 14 | | student.Property(a => a.CourseOfferingId); |
| 2 | 15 | | student.Property(a => a.Name); |
| 2 | 16 | | student.Property(a => a.EnrollmentCode); |
| | 17 | |
|
| 2 | 18 | | student.HasOne(a => a.User) |
| 2 | 19 | | .WithOne() |
| 2 | 20 | | .HasPrincipalKey<SykiUser>(u => new { u.InstitutionId, u.Id }) |
| 2 | 21 | | .HasForeignKey<SykiStudent>(a => new { a.InstitutionId, a.Id }); |
| | 22 | |
|
| 2 | 23 | | student.Property(x => x.YieldCoefficient).HasPrecision(4, 2); |
| | 24 | |
|
| 2 | 25 | | student.HasIndex(s => s.EnrollmentCode).IsUnique(); |
| 2 | 26 | | } |
| | 27 | | } |