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

18 lines
735 B
C#

using AccountManagement.Domain.ClientResponseMediaAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class ClientResponseMediaMapping:IEntityTypeConfiguration<ClientResponseMedia>
{
public void Configure(EntityTypeBuilder<ClientResponseMedia> builder)
{
builder.ToTable("ClientResponseMedias");
builder.HasKey(x => new { x.ClientResponseId, x.MediaId });
builder.HasOne(x => x.Media).WithMany(x => x.ClientResponseMedias).HasForeignKey(x => x.MediaId);
builder.HasOne(x => x.ClientResponse).WithMany(x => x.ClientResponseMedias).HasForeignKey(x => x.ClientResponseId);
}
}