using Company.Domain.LeftWorkInsuranceAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CompanyManagment.EFCore.Mapping; public class LeftWorkInsuranceMapping : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("LeftWorkInsurances"); builder.HasKey(x => x.id); builder.Property(x => x.LeftWorkDate) .HasColumnType("datetime2(7)") .IsRequired(false); builder.Property(x => x.EmployeeFullName).HasMaxLength(255); builder.Property(x => x.WorkshopName).HasMaxLength(255); builder.HasOne(x => x.Employee) .WithMany(x => x.LeftWorkInsurances) .HasForeignKey(x => x.EmployeeId); builder.HasOne(x => x.Workshop) .WithMany(x => x.LeftWorkInsurances) .HasForeignKey(x => x.WorkshopId); } }