Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Need help and advice in creating a complex relationship in EF 4.1
  2. public class TheObject{
  3.     public int ID {get;set;}
  4.     public string name {get;set;}
  5.  
  6.     public int? CategoryNavID {get;set;}
  7.     public virtual Category CategoryNav {get;set;}}
  8.  
  9. public class CategoryNav{
  10.     public int id {get;set;}
  11.     public virtual ICollection<Category> Category {get;set;}}
  12.  
  13. public class Category{
  14.     public int ID {get;set;}
  15.     public string name {get;set;}
  16.  
  17.     //The category this is currently in.
  18.     public int CategoryNavID
  19.  
  20.     //To create sub categories.
  21.     public int? CategoryID {get;set;}
  22.     public virtual Category Category {get;set;}}