CrewWidgetConfigConfiguration.cs 1.2 KB

123456789101112131415161718192021222324252627
  1. using Domain.Entities.Donations;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Donations;
  5. public class CrewWidgetConfigConfiguration : IEntityTypeConfiguration<CrewWidgetConfig>
  6. {
  7. public void Configure(EntityTypeBuilder<CrewWidgetConfig> builder)
  8. {
  9. builder.ToTable(nameof(CrewWidgetConfig), x => x.HasComment("크루 위젯 설정"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasOne(x => x.Channel).WithMany().HasForeignKey(x => x.ChannelID).OnDelete(DeleteBehavior.Cascade);
  12. builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.NoAction);
  13. builder.HasIndex(x => x.ChannelID);
  14. builder.Property(x => x.Title).HasMaxLength(300).IsRequired();
  15. builder.Property(x => x.BgColor).HasMaxLength(7);
  16. builder.Property(x => x.TitleFontColor).HasMaxLength(7);
  17. builder.Property(x => x.Rank1FontColor).HasMaxLength(7);
  18. builder.Property(x => x.Rank2FontColor).HasMaxLength(7);
  19. builder.Property(x => x.Rank3FontColor).HasMaxLength(7);
  20. builder.Property(x => x.RowFontColor).HasMaxLength(7);
  21. }
  22. }