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

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 1.26 KB  |  hits: 8  |  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. EF Code First Cyclical Reference
  2. public class Folder
  3. {
  4.     [Key]
  5.     public int FolderId { get; set; }
  6.     public string FolderName { get; set; }
  7.     public int ParentFolderId { get; set; }
  8.     public virtual Folder ParentFolder { get; set; }
  9.     public int IconId { get; set; }
  10.     public virtual Icon Icon { get; set; }
  11.  
  12.     public virtual ICollection<FileInformation> FileInformations { get; set; }
  13.     public virtual ICollection<Folder> Folders { get; set; }
  14. }
  15.  
  16. public class Icon
  17. {
  18.     [Key]
  19.     public int IconId { get; set; }
  20.     public string IconUrl { get; set; }
  21.     public string Description { get; set; }
  22. }
  23.        
  24. public class Folder
  25. {
  26.     [Key]
  27.     public int Id { get; set; }
  28.  
  29.     public string FolderName { get; set; }
  30.     public virtual int ParentId { get; set; } /*ParentFolderId*/
  31.     public virtual Folder Parent { get; set; } /*ParentFolder*/
  32.     public virtual int IconId { get; set; }
  33.     public virtual Icon Icon { get; set; }
  34.  
  35.     public virtual ICollection<Folder> Children { get; set; } /*not Folders*/
  36.  
  37.    //it is out of subject
  38.    //public virtual ICollection<FileInformation> FileInformations { get; // set; }
  39. }
  40.  
  41. public class Icon
  42. {
  43.     [Key]
  44.     public int Id { get; set; }
  45.  
  46.     public string IconUrl { get; set; }
  47.     public string Description { get; set; }
  48. }