SettlementAccountConfiguration.cs 1.0 KB

123456789101112131415161718192021222324
  1. using Domain.Entities.Donations;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Donations;
  5. public class SettlementAccountConfiguration : IEntityTypeConfiguration<SettlementAccount>
  6. {
  7. public void Configure(EntityTypeBuilder<SettlementAccount> builder)
  8. {
  9. builder.ToTable(nameof(SettlementAccount), x => x.HasComment("정산 계좌"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasOne(x => x.Channel).WithMany().HasForeignKey(x => x.ChannelID).OnDelete(DeleteBehavior.NoAction);
  12. builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.NoAction);
  13. builder.HasIndex(x => new { x.ChannelID, x.MemberID });
  14. builder.Property(x => x.BankCode).HasMaxLength(10);
  15. builder.Property(x => x.BankName).HasMaxLength(50);
  16. builder.Property(x => x.AccountNumber).HasMaxLength(500);
  17. builder.Property(x => x.AccountHolder).HasMaxLength(100);
  18. }
  19. }