24 lines
907 B
C#
24 lines
907 B
C#
namespace LiteCharms.Entities.Configuration;
|
|
|
|
public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Quote> builder)
|
|
{
|
|
builder.ToTable(nameof(Quote));
|
|
|
|
builder.HasKey(f => f.Id);
|
|
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd();
|
|
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
|
builder.Property(f => f.ExpiredAt).IsRequired(false);
|
|
builder.Property(f => f.CustomerId).IsRequired();
|
|
builder.Property(f => f.Status).IsRequired().HasConversion<int>();
|
|
builder.Property(f => f.ShoppingCartId).IsRequired();
|
|
builder.Property(f => f.Reason).IsRequired(false);
|
|
|
|
builder.HasOne(f => f.Customer)
|
|
.WithMany()
|
|
.HasForeignKey(f => f.CustomerId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|