using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings; public class PhaseSectionMapping:IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasKey(ps => ps.Id); builder.Property(ps => ps.Id) .ValueGeneratedOnAdd(); builder.HasOne(ps => ps.Phase) .WithMany(p => p.PhaseSections) .HasForeignKey(ps => ps.PhaseId) .OnDelete(DeleteBehavior.Cascade); builder.HasOne(ps => ps.Skill) .WithMany() .HasForeignKey(ps => ps.SkillId) .IsRequired(false) .OnDelete(DeleteBehavior.Restrict); } }