using Company.Domain.RepresentativeAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CompanyManagment.EFCore.Mapping; public class Representativemapping : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Representative"); builder.HasKey(x => x.id); builder.Property(x => x.FName).HasMaxLength(20); builder.Property(x => x.LName).HasMaxLength(20); builder.Property(x => x.LegalName).HasMaxLength(50); builder.Property(x => x.FullName).HasMaxLength(50); builder.Property(x => x.Nationalcode).HasMaxLength(10); builder.Property(x => x.IdNumber).HasMaxLength(20); builder.Property(x => x.RegisterId).HasMaxLength(20); builder.Property(x => x.NationalId).HasMaxLength(20); builder.Property(x => x.IsLegal).HasMaxLength(5); builder.Property(x => x.Phone).HasMaxLength(20); builder.Property(x => x.AgentPhone).HasMaxLength(20); builder.Property(x => x.IsActive).HasMaxLength(5); builder.Property(x => x.Address).HasMaxLength(50); //partent > fileEmployee builder.HasMany(x => x.FileEmployeeList) .WithOne(x => x.Representative) .HasForeignKey(x => x.RepresentativeId); //partent > fileEmployer builder.HasMany(x => x.FileEmployerList) .WithOne(x => x.Representative) .HasForeignKey(x => x.RepresentativeId); //partent > PersonalContractingParty builder.HasMany(x => x.ContractingParties) .WithOne(x => x.Representative) .HasForeignKey(x => x.RepresentativeId); } }