using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class EsgSecurityConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(EsgSecurity), t => t.HasComment("ESG 증권상품 일별시세 (KRX OpenAPI esg/esg_etp_info)")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.Name, x.TradeDate }).IsUnique(); builder.HasIndex(x => new { x.TradeDate, x.TradeValue }).IsDescending(false, true); builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("종목명 (ISU_ABBRV)"); builder.Property(x => x.Close).HasPrecision(18, 2).HasComment("현재가/종가 (TDD_CLSPRC)"); builder.Property(x => x.ChangeAmount).HasPrecision(18, 2).HasComment("전일비 (CMPPREVDD_PRC)"); builder.Property(x => x.ChangeRate).HasPrecision(9, 2).HasComment("등락률 % (FLUC_RT)"); builder.Property(x => x.ListedShares).HasComment("상장좌수 (LIST_SHRS)"); builder.Property(x => x.Volume).HasComment("거래량(좌) (ACC_TRDVOL)"); builder.Property(x => x.TradeValue).HasComment("거래대금(원) (ACC_TRDVAL)"); } }