39 lines
1.3 KiB
C#
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 PaymentReceiveConfiguration : IEntityTypeConfiguration<PaymentReceive>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PaymentReceive> builder)
|
|
{
|
|
builder.Property(e => e.InvoiceId)
|
|
.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.Invoice)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.InvoiceId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasOne(e => e.PaymentMethod)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.PaymentMethodId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
|
builder.HasIndex(e => e.InvoiceId);
|
|
builder.HasIndex(e => e.PaymentMethodId);
|
|
builder.HasIndex(e => e.PaymentDate);
|
|
}
|
|
} |