using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class InterestRateConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(InterestRate), t => t.HasComment("일별 금리 (한국수출입은행 OpenAPI AP02 대출금리 / AP03 국제금리)")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.RateType, x.ItemName, x.TradeDate }).IsUnique(); builder.HasIndex(x => x.TradeDate); builder.Property(x => x.RateType).HasConversion().IsRequired().HasComment("금리 종류 (1=대출금리, 2=국제금리)"); builder.Property(x => x.ItemName).HasMaxLength(100).IsRequired().HasComment("항목명 (cur_nm 등)"); builder.Property(x => x.Rate).HasPrecision(9, 4).HasComment("금리 % — 미고시 시 null"); } }