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