Implemented models
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user