34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
|
|
|
public class TaskSectionRevisionMapping:IEntityTypeConfiguration<TaskSectionRevision>
|
|
{
|
|
public void Configure(EntityTypeBuilder<TaskSectionRevision> builder)
|
|
{
|
|
builder.HasKey(x => x.Id);
|
|
|
|
builder.Property(x => x.Id)
|
|
.ValueGeneratedNever();
|
|
|
|
builder.Property(x => x.Status).HasConversion<string>()
|
|
.HasMaxLength(50);
|
|
|
|
builder.Property(x => x.Message).HasMaxLength(500);
|
|
|
|
builder.OwnsMany(x => x.Files, file =>
|
|
{
|
|
file.HasKey(x => x.Id);
|
|
file.Property(x => x.Id).ValueGeneratedNever();
|
|
|
|
file.HasOne<UploadedFile>()
|
|
.WithMany()
|
|
.HasForeignKey(x => x.FileId)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
});
|
|
}
|
|
} |