Files
pfm/PostFundManagement.Domain/Configuration/Outcome.cs
T
hermes 109fa0602e Added entity-model mappers
Added and applied field size constants
2026-08-16 10:08:33 +02:00

30 lines
1.1 KiB
C#

using static PostFundManagement.Domain.Extensions.Constants;
namespace PostFundManagement.Domain.Configuration;
public sealed class Outcome : IEntityTypeConfiguration<Entities.Outcome>
{
public void Configure(EntityTypeBuilder<Entities.Outcome> builder)
{
builder.ToTable(nameof(Entities.Outcome).Pluralize());
builder.HasKey(pk => pk.Id);
builder.Property(f => f.BeneficiaryId).IsRequired();
builder.Property(f => f.CreatedBy).IsRequired();
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
builder.Property(f => f.Name).IsRequired().HasMaxLength(LabelLength);
builder.Property(f => f.Description).IsRequired().HasMaxLength(TextLength);
builder.HasOne(f => f.Beneficiary)
.WithMany()
.HasForeignKey(fk => fk.BeneficiaryId)
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);
builder.HasOne(f => f.Creator)
.WithMany()
.HasForeignKey(fk => fk.CreatedBy)
.IsRequired()
.OnDelete(DeleteBehavior.NoAction);
}
}