Added shared projects
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace LiteCharms.Entities.Configuration;
|
||||
|
||||
public class ProductPriceConfiguration : IEntityTypeConfiguration<ProductPrice>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProductPrice> builder)
|
||||
{
|
||||
builder.ToTable(nameof(ProductPrice));
|
||||
|
||||
builder.HasKey(f => f.Id);
|
||||
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd();
|
||||
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
||||
builder.Property(f => f.ProductId).IsRequired();
|
||||
builder.Property(f => f.Price).IsRequired().HasPrecision(18, 2);
|
||||
builder.Property(f => f.Discount).HasPrecision(18, 2);
|
||||
builder.Property(f => f.Active);
|
||||
|
||||
builder.HasOne(f => f.Product)
|
||||
.WithMany(p => p.ProductPrices)
|
||||
.HasForeignKey(f => f.ProductId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user