[training]ASP.NET MVC 5 – Code First

      //資料模型一對多關聯      public class Guestbook      {          public int Id { get; set; }          public string Content { get; set; }          public DateTime CreateTime { get; set; }          public Member Member { get; set; }      }        public class Member      {          [Key]          public string Username { get; set; }          public string Password { get; set; }          public string Name { get; set; }          public string Email { get; set; }            public ICollection<Guestbook> Guestbook { get; set; }      }      //Code First 就是在Model定義好各欄位後,其他的Controller、View都會自動幫你產生,      //很神奇的功能,讓你專注在寫Model的部分就好  

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.