diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs index a763ddd8..1408c86b 100644 --- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs @@ -1,3 +1,4 @@ +using GozareshgirProgramManager.Domain.FileManagementAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -16,10 +17,17 @@ public class TaskSectionRevisionMapping:IEntityTypeConfiguration x.Status).HasConversion(); builder.Property(x => x.Message).HasMaxLength(500); - - builder.OwnsMany(x=>x.Files, file => + + builder.OwnsMany(x => x.Files, file => { - - }) + file.HasKey(x => x.Id); + file.Property(x => x.Id).ValueGeneratedNever(); + + file.HasOne() + .WithMany() + .HasForeignKey(x => x.FileId) + .IsRequired() + .OnDelete(DeleteBehavior.Restrict); + }); } } \ No newline at end of file