PaperAccountConfiguration.cs 1.4 KB

1234567891011121314151617181920212223242526
  1. using Domain.Entities.Paper;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Paper;
  5. public sealed class PaperAccountConfiguration : IEntityTypeConfiguration<PaperAccount>
  6. {
  7. public void Configure(EntityTypeBuilder<PaperAccount> builder)
  8. {
  9. builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.Cascade);
  10. builder.HasIndex(x => x.MemberID).IsUnique();
  11. builder.ToTable(nameof(PaperAccount), t => t.HasComment("모의투자 계좌 (회원당 1개)"));
  12. builder.HasKey(x => x.ID);
  13. builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK");
  14. builder.Property(x => x.MemberID).IsRequired().HasComment("회원 ID");
  15. builder.Property(x => x.Token).HasPrecision(18, 0).IsRequired().HasComment("자유 현금 토큰");
  16. builder.Property(x => x.ReservedToken).HasPrecision(18, 0).IsRequired().HasComment("매수 예약 토큰");
  17. builder.Property(x => x.Units).HasPrecision(18, 8).IsRequired().HasComment("좌수");
  18. builder.Property(x => x.TotalDeposited).HasPrecision(18, 0).IsRequired().HasComment("누적 입금");
  19. builder.Property(x => x.TotalWithdrawn).HasPrecision(18, 0).IsRequired().HasComment("누적 출금");
  20. builder.Property(x => x.CreatedAt).IsRequired();
  21. builder.Property(x => x.RowVersion).IsRowVersion();
  22. }
  23. }