23 lines
941 B
C#
23 lines
941 B
C#
namespace PostFundManagement.Domain.Configuration;
|
|
|
|
public sealed class Instrument : IEntityTypeConfiguration<Entities.Instrument>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Entities.Instrument> builder)
|
|
{
|
|
builder.ToTable(nameof(Entities.Instrument).Pluralize());
|
|
|
|
builder.HasKey(pk => pk.Id);
|
|
builder.Property(f => f.Code).IsRequired().HasMaxLength(50);
|
|
builder.Property(f => f.Name).IsRequired().HasMaxLength(256);
|
|
builder.Property(f => f.Description).IsRequired(false).HasMaxLength(1024);
|
|
builder.Property(f => f.Status).IsRequired().HasDefaultValue(ActivityStatus.Inactive);
|
|
builder.Property(f => f.CreatedBy).IsRequired();
|
|
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
|
|
|
builder.HasOne(f => f.Creator)
|
|
.WithMany()
|
|
.HasForeignKey(f => f.CreatedBy)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
}
|
|
}
|