5
Answers

Reference Foreign Key with 3 Foreign Key But 1 Table

Guest User

Guest User

5y
528
1
  1. public class Category  
  2. {  
  3. public Guid Id { getset; }  
  4. public string Name { getset; }  
  5. }  
  6. public class Product  
  7. {  
  8. public Guid Id { getset; }  
  9. public Guid CategoryId2 { getset; }  
  10. public Guid CategoryId3 { getset; }  
  11. public string Code { getset; }  
  12. public string Name { getset; }  
  13. [ForeignKey("Category")]  
  14. public Guid CategoryId1 { getset; }  
  15. public virtual Category Category { getset; }  
  16. }  
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?
Answers (5)