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