DividendConfiguration.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536
  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 DividendConfiguration : IEntityTypeConfiguration<Dividend>
  6. {
  7. public void Configure(EntityTypeBuilder<Dividend> builder)
  8. {
  9. builder.ToTable(nameof(Dividend), t => t.HasComment("SEIBro 배당분배금내역 (getDivInfo) — 종목별 배정비율·금액·시가배당율. Isin 으로 Stock 조인"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasIndex(x => new { x.Isin, x.RgtStdDt }).IsUnique();
  12. builder.HasIndex(x => x.RgtStdDt);
  13. builder.Property(x => x.Isin).HasMaxLength(12).IsFixedLength().IsRequired().HasComment("종목번호 (ISIN)");
  14. builder.Property(x => x.KorSecnNm).HasMaxLength(100).IsRequired().HasComment("한글종목명 (KOR_SECN_NM)");
  15. builder.Property(x => x.SecnKacdNm).HasMaxLength(20).HasComment("종목종류 (SECN_KACD_NM) — 보통주/우선주…");
  16. builder.Property(x => x.RgtStdDt).IsRequired().HasComment("권리기준일자 (RGT_STD_DT)");
  17. // 스펙 NUMBER(30,20)/(23,18) — SQL Server decimal 최대(38,x) 안에서 decimal(28,10) 로 안전 설정
  18. builder.Property(x => x.Pval).HasPrecision(28, 10).HasComment("액면가 (PVAL)");
  19. builder.Property(x => x.StkAllocRatio).HasPrecision(28, 10).HasComment("주식배정비율 (STK_ALOC_RATIO)");
  20. builder.Property(x => x.CashAllocRatio).HasPrecision(28, 10).HasComment("현금배정비율 (CASH_ALOC_RATIO)");
  21. builder.Property(x => x.CashAllocAmt).HasPrecision(28, 10).HasComment("현금배정금액 (CASH_ALOC_AMT) — 1주당 현금배당");
  22. builder.Property(x => x.MartpDivRate).HasPrecision(28, 10).HasComment("시가배당율 (MARTP_DIV_RATE)");
  23. builder.Property(x => x.Th1PayTermBeginDt).HasComment("배당지급일(현금, TH1_PAY_TERM_BEGIN_DT)");
  24. builder.Property(x => x.DeliDt).HasComment("교부일자(주식, DELI_DT)");
  25. builder.Property(x => x.MajshrEtcDiffAllocYn).HasComment("대주주기타차등배정여부 (MAJSHR_ETC_DIFF_ALOC_YN)");
  26. builder.Property(x => x.TstkNoagnYn).HasComment("자사주무배정여부 (TSTK_NOAGN_YN)");
  27. builder.Property(x => x.CashDiffDiviAmt).HasPrecision(28, 10).HasComment("현금차등배당금액 (CASH_DIFF_DIVIAMT_VAL)");
  28. builder.Property(x => x.CashDiffDiviRate).HasPrecision(28, 10).HasComment("현금차등배당율 (CASH_DIFF_DIVI_RATE)");
  29. builder.Property(x => x.StkDiffDiviRate).HasPrecision(28, 10).HasComment("주식차등배당율 (STK_DIFF_DIVI_RATE)");
  30. builder.Property(x => x.MartpDiffDiviRate).HasPrecision(28, 10).HasComment("시가차등배당율 (MARTP_DIFF_DIVI_RATE)");
  31. }
  32. }