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

21 lines
754 B
C#

using Company.Domain.FileAndFileEmployerAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class FileAndFileEmployerMapping : IEntityTypeConfiguration<FileAndFileEmployer>
{
public void Configure(EntityTypeBuilder<FileAndFileEmployer> builder)
{
builder.ToTable("FileAndFileEmployers");
builder.HasKey(x => new { x.FileId, x.FileEmployerId });
builder.HasOne(x => x.File1)
.WithMany(x => x.FileAndFileEmployers)
.HasForeignKey(x => x.FileId);
builder.HasOne(x => x.FileEmployer)
.WithMany(x => x.FileAndFileEmployers)
.HasForeignKey(x => x.FileEmployerId);
}
}