using Domain.Entities.Store; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Store; public sealed class GameCategoryMapConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(GameCategoryMap), t => t.HasComment("게임-카테고리 N:M")); builder.HasKey(x => new { x.GameID, x.GameCategoryID }); builder.HasOne(x => x.Game).WithMany(x => x.GameCategoryMap).HasForeignKey(x => x.GameID).OnDelete(DeleteBehavior.Cascade); builder.HasOne(x => x.GameCategory).WithMany(x => x.GameCategoryMap).HasForeignKey(x => x.GameCategoryID).OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => x.GameCategoryID); } }