Files
blazor-saas-crm/Infrastructure/Database/MsSQL/Configuration/PaymentDisburseConfiguration.cs
T
2026-07-21 14:14:44 +07:00

39 lines
1.3 KiB
C#

using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class PaymentDisburseConfiguration : IEntityTypeConfiguration<PaymentDisburse>
{
public void Configure(EntityTypeBuilder<PaymentDisburse> builder)
{
builder.Property(e => e.BillId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.AutoNumber)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(e => e.PaymentMethodId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.HasOne(e => e.Bill)
.WithMany()
.HasForeignKey(e => e.BillId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasOne(e => e.PaymentMethod)
.WithMany()
.HasForeignKey(e => e.PaymentMethodId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(e => e.BillId);
builder.HasIndex(e => e.PaymentMethodId);
builder.HasIndex(e => e.PaymentDate);
}
}