using IRaCIS.Core.Domain.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { public class AuditDocumentConfigration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasMany(r => r.AncestorList).WithOne(t => t.Descendant).HasForeignKey(f => f.DescendantId); builder.HasMany(r => r.DescendantList).WithOne(t => t.Ancestor).HasForeignKey(f => f.AncestorId); builder.HasMany(r => r.AuditDocumentOldVersionList).WithOne(t => t.MainAuditDocument).HasForeignKey(f => f.MainFileId); // builder.HasOne(r => r.WordFileRecord) //.WithOne(t => t.WordFileRecord) //.HasForeignKey(t => t.WordFileRecordId) //.OnDelete(DeleteBehavior.Cascade); // builder.HasOne(r => r.PDFFileRecord).WithOne().HasForeignKey(f => f.TrialFileTypeId); // builder.HasOne(r => r.WordFileRecord).WithOne().HasForeignKey(f => f.TrialFileTypeId); // builder.HasOne(r => r.SignFileRecord).WithOne().HasForeignKey(f => f.TrialFileTypeId); // builder.HasOne(r => r.HistoryFileRecord).WithOne().HasForeignKey(f => f.TrialFileTypeId); } } }