using Company.Domain.EmployeeDocumentsAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CompanyManagment.EFCore.Mapping { public class EmployeeDocumentsMapping : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("EmployeeDocuments"); builder.HasKey(x => x.id); builder.Property(x => x.Gender).HasMaxLength(10).IsRequired(); builder.HasOne(x => x.Employee).WithMany(x => x.EmployeeDocuments) .HasForeignKey(x => x.EmployeeId); builder.HasMany(x => x.EmployeeDocumentItemCollection).WithOne(x => x.EmployeeDocuments) .HasForeignKey(x=>x.EmployeeDocumentId); //builder.Navigation(x => x.EmployeeDocumentCollection).EnableLazyLoading(); } } }