24 lines
1.1 KiB
C#
24 lines
1.1 KiB
C#
namespace PostFundManagement.Domain.Configuration;
|
|
|
|
public sealed class Organisation : IEntityTypeConfiguration<Entities.Organisation>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Entities.Organisation> builder)
|
|
{
|
|
builder.ToTable(nameof(Entities.Organisation).Pluralize());
|
|
|
|
builder.HasKey(pk => pk.Id);
|
|
builder.Property(f => f.CreatedBy).IsRequired();
|
|
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
|
builder.Property(f => f.RegistrationNo).IsRequired().HasMaxLength(256);
|
|
builder.Property(f => f.Name).IsRequired().HasMaxLength(256);
|
|
builder.Property(f => f.Email).IsRequired().HasMaxLength(256);
|
|
builder.Property(f => f.Type).IsRequired().HasDefaultValue(OrganisationType.PrivateLimitedCompany);
|
|
builder.Property(f => f.Status).IsRequired().HasDefaultValue(ActivityStatus.Active);
|
|
|
|
builder.HasOne(f => f.Creator)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.CreatedBy)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
}
|
|
} |