MacroIndicatorConfiguration.cs 1.1 KB

123456789101112131415161718192021
  1. using Domain.Entities.Stocks;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Stocks;
  5. public sealed class MacroIndicatorConfiguration : IEntityTypeConfiguration<MacroIndicator>
  6. {
  7. public void Configure(EntityTypeBuilder<MacroIndicator> builder)
  8. {
  9. builder.ToTable(nameof(MacroIndicator), t => t.HasComment("거시경제지표 시계열 (KOSIS 국가통계포털 OpenAPI 수집)"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasIndex(x => new { x.Code, x.Period }).IsUnique();
  12. builder.Property(x => x.Code).HasMaxLength(40).IsRequired().HasComment("지표 내부코드 (config Code)");
  13. builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("지표 표시명");
  14. builder.Property(x => x.Period).HasMaxLength(8).IsRequired().HasComment("수록 시점 (PRD_DE — 월 YYYYMM / 분기 YYYYQ / 연 YYYY)");
  15. builder.Property(x => x.Value).HasPrecision(18, 4).HasComment("수치 (DT)");
  16. builder.Property(x => x.Unit).HasMaxLength(40).HasComment("단위 (UNIT_NM)");
  17. }
  18. }