- 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; }
- }
Reference Foreign Key with 3 Foreign Key But 1 Table
I have these 2 tables. The Product has 3 foreign key which I need to connect in Category. I only sure about the CategoryId1 but I dont know what to do in CategoryId2 and CategoryId3. what should I do?

Madan ShekarRank #428 · 5.9K reputationPosted Jan 13, 2020, 6:48 PM EST
ID Productname CategoryID
Guest User96 reputationPosted Jan 13, 2020, 7:24 PM EST
Guest User96 reputationPosted Jan 14, 2020, 3:44 PM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Jan 15, 2020, 7:07 AM EST
Guest User96 reputationPosted Jan 15, 2020, 8:15 AM EST