This is my tables in SQL Server with Category table and need to be reference in Product table with 3 CategoryId.

What solution should I do? especially in Entity Core..
Do I need to 2 more tables for Category with the same content?
what I did to the entity is just like the code below but I'm not sure if this is correct or not..
public class Category
{
public Guid Id { get; set; }
public string Name { get; set; }
}
public class Product
{
public Guid Id { get; set; }
public Guid CategoryId2 { get; set; }
public Guid CategoryId3 { get; set; }
public string Code { get; set; }
public string Name { get; set; }
[ForeignKey("Category")]
public Guid CategoryId1 { get; set; }
public virtual Category Category { get; set; }
}
Ronika JencyPosted Jan 21, 2020, 10:56 AM