
Untitled
By: a guest on
Jul 29th, 2012 | syntax:
None | size: 1.26 KB | hits: 8 | expires: Never
EF Code First Cyclical Reference
public class Folder
{
[Key]
public int FolderId { get; set; }
public string FolderName { get; set; }
public int ParentFolderId { get; set; }
public virtual Folder ParentFolder { get; set; }
public int IconId { get; set; }
public virtual Icon Icon { get; set; }
public virtual ICollection<FileInformation> FileInformations { get; set; }
public virtual ICollection<Folder> Folders { get; set; }
}
public class Icon
{
[Key]
public int IconId { get; set; }
public string IconUrl { get; set; }
public string Description { get; set; }
}
public class Folder
{
[Key]
public int Id { get; set; }
public string FolderName { get; set; }
public virtual int ParentId { get; set; } /*ParentFolderId*/
public virtual Folder Parent { get; set; } /*ParentFolder*/
public virtual int IconId { get; set; }
public virtual Icon Icon { get; set; }
public virtual ICollection<Folder> Children { get; set; } /*not Folders*/
//it is out of subject
//public virtual ICollection<FileInformation> FileInformations { get; // set; }
}
public class Icon
{
[Key]
public int Id { get; set; }
public string IconUrl { get; set; }
public string Description { get; set; }
}