using Company.Domain.InsuranceListAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CompanyManagment.EFCore.Mapping; public class InsuranceListMapping : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("InsuranceLists"); builder.HasKey(x => x.id); builder.Property(x => x.Year).HasMaxLength(4); builder.Property(x => x.Month).HasMaxLength(2); builder.ComplexProperty(x => x.Inspection, inspection => { inspection.IsRequired(); inspection.Property(x => x.Type).HasConversion().HasMaxLength(50); inspection.Property(x => x.LastInspectionDateTime); inspection.Property(x => x.MediaId); }); builder.ComplexProperty(x => x.Debt, debt => { debt.IsRequired(); debt.Property(x => x.Type).HasConversion().HasMaxLength(50); debt.Property(x => x.DebtDate); debt.Property(x => x.Amount); debt.Property(x => x.MediaId); }); builder.ComplexProperty(x => x.EmployerApproval, approval => { approval.IsRequired(); approval.Property(x => x.Status).HasConversion().HasMaxLength(50); approval.Property(x => x.Description).HasMaxLength(500); }); //builder.HasMany(x => x.EmployerSignatures) // .WithOne(x => x.InsuranceList).HasForeignKey(x => x.InsuranceListId); } }