SriBondConfiguration.cs 1.7 KB

12345678910111213141516171819202122232425262728
  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 SriBondConfiguration : IEntityTypeConfiguration<SriBond>
  6. {
  7. public void Configure(EntityTypeBuilder<SriBond> builder)
  8. {
  9. builder.ToTable(nameof(SriBond), t => t.HasComment("사회책임투자채권(SRI) 정보 스냅샷 (KRX OpenAPI esg/sri_bond_info)"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasIndex(x => new { x.Code, x.TradeDate }).IsUnique();
  12. builder.HasIndex(x => new { x.TradeDate, x.SriBondType });
  13. builder.Property(x => x.Code).HasMaxLength(12).IsRequired().HasComment("표준코드 (ISU_CD) — 12자리 ISIN");
  14. builder.Property(x => x.IssuerName).HasMaxLength(100).IsRequired().HasComment("발행기관 (ISUR_NM)");
  15. builder.Property(x => x.SriBondType).HasMaxLength(30).IsRequired().HasComment("채권종류 (SRI_BND_TP_NM)");
  16. builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("종목명 (ISU_NM)");
  17. builder.Property(x => x.ListDate).HasComment("상장일 (LIST_DD)");
  18. builder.Property(x => x.IssueDate).HasComment("발행일 (ISU_DD)");
  19. builder.Property(x => x.RedemptionDate).HasComment("상환일 (REDMPT_DD)");
  20. builder.Property(x => x.CouponRate).HasPrecision(9, 5).HasComment("표면이자율 % (ISU_RT)");
  21. builder.Property(x => x.IssueAmount).HasComment("발행금액 (ISU_AMT, 원)");
  22. builder.Property(x => x.ListAmount).HasComment("상장금액 (LIST_AMT, 원)");
  23. builder.Property(x => x.BondType).HasMaxLength(30).HasComment("채권유형 (BND_TP_NM)");
  24. }
  25. }