Files
Backend-Api/CompanyManagment.EFCore/Mapping/PaymentInstrumentMapping.cs
2025-07-30 17:03:01 +03:30

24 lines
1020 B
C#

using Company.Domain.PaymentInstrumentAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class PaymentInstrumentMapping : IEntityTypeConfiguration<PaymentInstrument>
{
public void Configure(EntityTypeBuilder<PaymentInstrument> builder)
{
builder.HasKey(x => x.id);
builder.Property(x => x.AccountHolderName).HasMaxLength(50);
builder.Property(x => x.AccountNumber).HasMaxLength(25);
builder.Property(x => x.PosTerminalId).HasMaxLength(25);
builder.Property(x => x.Description).HasMaxLength(200);
builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
builder.Property(x => x.CardNumber).HasMaxLength(50);
builder.Property(x => x.IBan).HasMaxLength(50);
builder.HasOne(x => x.PaymentInstrumentGroup)
.WithMany(x => x.PaymentInstruments)
.HasForeignKey(x => x.PaymentInstrumentGroupId);
}
}