using Domain.Entities.Page.Popup; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Page; public sealed class PopupPositionConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasMany(x => x.Popups).WithOne(x => x.PopupPosition).HasForeignKey(x => x.PositionID).OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => x.Code).IsUnique(); builder.HasIndex(x => x.IsActive); builder.HasIndex(x => new { x.Code, x.IsActive }); builder.ToTable(nameof(PopupPosition), t => t.HasComment("팝업 위치")); builder.HasKey(x => x.ID); builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK"); builder.Property(x => x.Code).HasMaxLength(30).IsRequired().HasComment("위치 구분"); builder.Property(x => x.Subject).HasMaxLength(255).IsRequired().HasComment("위치 명"); builder.Property(x => x.IsActive).IsRequired().HasComment("사용 여부"); builder.Property(x => x.UpdatedAt).HasComment("수정 일시"); builder.Property(x => x.CreatedAt).IsRequired().HasComment("등록 일시"); } }