27 lines
927 B
C#
27 lines
927 B
C#
using Company.Domain.EmployeeDocumentsAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping
|
|
{
|
|
public class EmployeeDocumentsMapping : IEntityTypeConfiguration<EmployeeDocuments>
|
|
{
|
|
public void Configure(EntityTypeBuilder<EmployeeDocuments> 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();
|
|
}
|
|
}
|
|
}
|