Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public class MyImprovement
  2. {
  3. [Key]
  4. public int MyImprovementId { get; set; }
  5. public virtual ICollection<MyCondition> Conditions { get; set; }
  6. }
  7.  
  8. public class MyCondition
  9. {
  10. [Key]
  11. public int MyConditionId { get; set; }
  12. public int? ComponentId { get; set; }
  13. public virtual MyComponent ConditionalMyComponent { get; set; }
  14. }
  15.  
  16. public class MyComponent
  17. {
  18. [Key]
  19. public int ComponentId { get; set; }
  20. public string PDNumber { get; set; }
  21. }
  22.  
  23. // Code to load the first 2 levels of objects
  24. MyImprovement improvement = dbx.MyImprovements
  25. .Include("Conditions")
  26. .Where(x => x.ImprovementId == id)
  27. .First();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement