I trying to add an existing product id as a foreign key in my Entity.
I have created DiscountType class and added a property for products
public class DiscountType : BaseEntity
{
public string TypeCode { get; set; }
public string TypeName { get; set; }
//Product is existing class of nop commerce
public Product product { get; set; }
}
Created DiscountTypeMap class and added relation between both tables
public class DiscountTypeMap : NopEntityTypeConfiguration<DiscountType>
{
public override void Configure(EntityTypeBuilder<DiscountType > builder)
{
builder.ToTable(nameof(DiscountType ));
builder.HasKey(point => point.Id);
builder.HasOne<Product>(s => s.Product);
}
}
When running the plugin I am getting the following error
"Navigation property 'Addresses' on entity type 'Customer' is not virtual. UseLazyLoadingProxies requires all entity types to be public, unsealed, have virtual navigation properties, and have a public or protected constructor."
I am not sure why this error is coming. Please share if I missed anything.
Thank You in advance.