I have Product table that have category1 and category2 field,
and each field contain a number(ID) that indicate Category Table ID (FK).
and I want to add entity for set category name when I retrieve data, but I don't know how to make category1_name and category2_name can have category name. (very hard to explain =3)
EX)
public class Product
{
[Key]
public int no {get; set;}
public int category1 {get; set;} // category table ID number
public int category2 { get; set;} // category table ID number
public virtual Category category1_name {get; set;}
public virtual Category category2_name {get; set;}
}
public class Category
{
[Key]
public int no {get; set;}
public string category {get; set;}
}
But when I try to retrieve data, I got an error,
Unknown column 'Extent1.category1_name_no' in 'on clause'
How can I mapping the category1_name to category table ID?