21 lines
698 B
C#
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);
|
|
}
|
|
} |