| 12345678910111213141516171819 |
- using Domain.Entities.Store;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Store;
- public sealed class GameCategoryMapConfiguration : IEntityTypeConfiguration<GameCategoryMap>
- {
- public void Configure(EntityTypeBuilder<GameCategoryMap> 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);
- }
- }
|