I’m making an e-commerce website and i have product entity with basic propertys
<code> {
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public decimal Price { get; set; }
public string? ImageUrl { get; set; }
public int? CategoryId { get; set; }
public Category? Category { get; set; }
public string? Brand { get; set; }
}
</code>
<code> {
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public decimal Price { get; set; }
public string? ImageUrl { get; set; }
public int? CategoryId { get; set; }
public Category? Category { get; set; }
public string? Brand { get; set; }
}
</code>
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public decimal Price { get; set; }
public string? ImageUrl { get; set; }
public int? CategoryId { get; set; }
public Category? Category { get; set; }
public string? Brand { get; set; }
}
So if I’m not wrong if i want to create a laptop so i need to make another entity and inherite from Product,is this right approach? because i will have to make table for every specific product
New contributor
Evergreen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.