GameGenreConfiguration.cs 984 B

123456789101112131415161718192021222324
  1. using Domain.Entities.Store;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Store;
  5. public sealed class GameGenreConfiguration : IEntityTypeConfiguration<GameGenre>
  6. {
  7. public void Configure(EntityTypeBuilder<GameGenre> builder)
  8. {
  9. builder.ToTable(nameof(GameGenre), t => t.HasComment("게임 장르 코드"));
  10. builder.HasKey(x => x.ID);
  11. builder.Property(x => x.KorName).HasMaxLength(100).IsRequired().HasComment("장르 한글명");
  12. builder.Property(x => x.EngName).HasMaxLength(100).HasComment("장르 영문명");
  13. builder.Property(x => x.Order).IsRequired();
  14. builder.Property(x => x.IsActive).IsRequired();
  15. builder.Property(x => x.CreatedAt).IsRequired();
  16. builder.Property(x => x.UpdatedAt);
  17. builder.HasIndex(x => x.KorName).IsUnique();
  18. builder.HasIndex(x => new { x.IsActive, x.Order });
  19. }
  20. }