GameProductCatalogConfiguration.cs 814 B

12345678910111213141516171819
  1. using Domain.Entities.Store;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Store;
  5. public class GameProductCatalogConfiguration : IEntityTypeConfiguration<GameProductCatalog>
  6. {
  7. public void Configure(EntityTypeBuilder<GameProductCatalog> builder)
  8. {
  9. builder.HasIndex(x => new { x.GameID, x.ProductID }).IsUnique();
  10. builder.ToTable(nameof(GameProductCatalog), x => x.HasComment("게임별 인앱 상품 SKU 정가 카탈로그 (API 결제 보고가 검증용)"));
  11. builder.HasKey(x => x.ID);
  12. builder.Property(x => x.ProductID).HasMaxLength(100).IsRequired();
  13. builder.HasOne(x => x.Game).WithMany().HasForeignKey(x => x.GameID).OnDelete(DeleteBehavior.Cascade);
  14. }
  15. }