PopupConfiguration.cs 1.5 KB

123456789101112131415161718192021222324252627282930
  1. using Domain.Entities.Page.Popup;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Page;
  5. public sealed class PopupConfiguration : IEntityTypeConfiguration<Popup>
  6. {
  7. public void Configure(EntityTypeBuilder<Popup> builder)
  8. {
  9. builder.HasIndex(x => x.PositionID);
  10. builder.HasIndex(x => x.Order);
  11. builder.HasIndex(x => new { x.Order, x.IsActive });
  12. builder.HasIndex(x => new { x.StartAt, x.EndAt, x.Order, x.IsActive });
  13. builder.ToTable(nameof(Popup), t => t.HasComment("팝업"));
  14. builder.HasKey(x => x.ID);
  15. builder.Property(x => x.ID) .ValueGeneratedOnAdd() .HasComment("PK");
  16. builder.Property(x => x.PositionID).IsRequired().HasComment("팝업 위치 ID");
  17. builder.Property(x => x.Subject).HasMaxLength(255).IsRequired().HasComment("제목");
  18. builder.Property(x => x.Content).HasMaxLength(4000).HasComment("내용");
  19. builder.Property(x => x.Link).HasMaxLength(255).HasComment("주소");
  20. builder.Property(x => x.StartAt).HasComment("사용 기간 - 시작");
  21. builder.Property(x => x.EndAt).HasComment("사용 기간 - 종료");
  22. builder.Property(x => x.Order).IsRequired().HasComment("순서");
  23. builder.Property(x => x.IsActive).IsRequired().HasComment("사용 여부");
  24. builder.Property(x => x.UpdatedAt).HasComment("수정 일시");
  25. builder.Property(x => x.CreatedAt).IsRequired().HasComment("등록 일시");
  26. }
  27. }