Files
Backend-Api/CompanyManagment.EFCore/Mapping/PersonnelCodeMapping.cs
2024-07-05 21:36:15 +03:30

21 lines
698 B
C#

using Company.Domain.PersonnelCodeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class PersonnelCodeMapping :IEntityTypeConfiguration<PersonnelCodeDomain>
{
public void Configure(EntityTypeBuilder<PersonnelCodeDomain> builder)
{
builder.ToTable("PersonnelCodes");
builder.HasKey(x => x.id);
builder.HasOne(x => x.Workshop)
.WithMany(x => x.PersonnelCodeList)
.HasForeignKey(x => x.WorkshopId);
builder.HasOne(x => x.Employee)
.WithMany(x => x.PersonnelCodeList)
.HasForeignKey(x => x.EmployeeId);
}
}