Guest User

EF Navigation

a guest
Oct 21st, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1.  public class Page
  2.     {
  3.         public int Id { get; set; }
  4.         public string MyProperty { get; set; }
  5.         public string MyProperty2 { get; set; }
  6.  
  7.         public int? CommentId { get; set; }
  8.         [ForeignKey("CommentId")]
  9.         public virtual Comment Comments { get; set; }
  10.     }
  11.  
  12.     public class Post
  13.     {
  14.         public int Id { get; set; }
  15.         public string MyProperty { get; set; }
  16.         public string MyProperty2 { get; set; }
  17.  
  18.         public int? CommentId { get; set; }
  19.         [ForeignKey("CommentId")]
  20.         public virtual Comment Comments { get; set; }
  21.     }
  22.  
  23.     public class Comment
  24.     {
  25.         public int Id { get; set; }
  26.         public string MyProperty { get; set; }
  27.         public string MyProperty2 { get; set; }
  28.         public virtual Page Page { get; set; }
  29.         public virtual Post Post { get; set; }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment