| 12345678910111213141516171819202122232425 |
- using Domain.Entities.Paper;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Paper;
- public sealed class PaperPositionConfiguration : IEntityTypeConfiguration<PaperPosition>
- {
- public void Configure(EntityTypeBuilder<PaperPosition> builder)
- {
- builder.HasOne(x => x.Account).WithMany().HasForeignKey(x => x.AccountID).OnDelete(DeleteBehavior.Cascade);
- builder.HasIndex(x => new { x.AccountID, x.StockCode }).IsUnique();
- builder.ToTable(nameof(PaperPosition), t => t.HasComment("모의투자 보유 포지션"));
- builder.HasKey(x => x.ID);
- builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK");
- builder.Property(x => x.AccountID).IsRequired().HasComment("계좌 ID");
- builder.Property(x => x.StockCode).HasMaxLength(6).IsFixedLength().IsRequired().HasComment("단축코드");
- builder.Property(x => x.Quantity).IsRequired().HasComment("보유 수량");
- builder.Property(x => x.ReservedQuantity).IsRequired().HasComment("매도 예약 수량");
- builder.Property(x => x.AvgPrice).HasPrecision(18, 4).IsRequired().HasComment("평균 단가");
- builder.Property(x => x.UpdatedAt).IsRequired();
- builder.Property(x => x.RowVersion).IsRowVersion();
- }
- }
|