This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace LiteCharms.Entities.Configuration;
|
||||
|
||||
public class ShoppingCartPackageConfiguration : IEntityTypeConfiguration<ShoppingCartPackage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ShoppingCartPackage> builder)
|
||||
{
|
||||
builder.ToTable(nameof(ShoppingCartPackage));
|
||||
|
||||
builder.HasKey(f => f.Id);
|
||||
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd();
|
||||
builder.Property(f => f.ShoppingCartId).IsRequired();
|
||||
builder.Property(f => f.PackageId).IsRequired();
|
||||
|
||||
builder.HasOne(f => f.Package)
|
||||
.WithMany()
|
||||
.HasForeignKey(f => f.PackageId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(f => f.ShoppingCart)
|
||||
.WithMany()
|
||||
.HasForeignKey(f => f.ShoppingCartId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user