| 12345678910111213141516171819202122232425 |
- using Domain.Entities.Page.Banner;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Page.Banner;
- public sealed class BannerPositionConfiguration : IEntityTypeConfiguration<BannerPosition>
- {
- public void Configure(EntityTypeBuilder<BannerPosition> builder)
- {
- builder.HasMany(x => x.BannerItems).WithOne(x => x.BannerPosition).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(BannerPosition), 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("등록 일시");
- }
- }
|