| 123456789101112131415161718192021 |
- using Domain.Entities.Stocks;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Stocks;
- public sealed class StockWatchConfiguration : IEntityTypeConfiguration<StockWatch>
- {
- public void Configure(EntityTypeBuilder<StockWatch> builder)
- {
- builder.ToTable(nameof(StockWatch), x => x.HasComment("회원 관심종목"));
- builder.HasKey(x => x.ID);
- builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK");
- builder.Property(x => x.MemberID).IsRequired().HasComment("관심 등록 회원 ID");
- builder.Property(x => x.StockCode).IsRequired().HasMaxLength(6).IsFixedLength().HasComment("단축코드 (char 6, Stock.Code denorm)");
- builder.Property(x => x.CreatedAt).IsRequired().HasComment("등록 일시");
- builder.HasIndex(x => new { x.MemberID, x.StockCode }).IsUnique();
- builder.HasIndex(x => new { x.MemberID, x.CreatedAt }).IsDescending(false, true);
- }
- }
|