Files
Backend-Api/AccountMangement.Infrastructure.EFCore/Mappings/AdminResponseMediaMapping.cs
2024-07-10 20:25:54 +03:30

18 lines
725 B
C#

using AccountManagement.Domain.AdminResponseMediaAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class AdminResponseMediaMapping:IEntityTypeConfiguration<AdminResponseMedia>
{
public void Configure(EntityTypeBuilder<AdminResponseMedia> builder)
{
builder.ToTable("AdminResponseMedias");
builder.HasKey(x => new { x.AdminResponseId, x.MediaId });
builder.HasOne(x => x.Media).WithMany(x => x.AdminResponseMedias).HasForeignKey(x => x.MediaId);
builder.HasOne(x => x.AdminResponse).WithMany(x => x.AdminResponseMedias).HasForeignKey(x => x.AdminResponseId);
}
}