From 025c59e6954ffc5fcc290ea6d4cd1f3f9daef979 Mon Sep 17 00:00:00 2001 From: mahan Date: Wed, 21 Jan 2026 19:21:26 +0330 Subject: [PATCH] Complete TaskSectionRevisionMapping.cs --- .../Mappings/TaskSectionRevisionMapping.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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