//資料模型一對多關聯 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的部分就好
[latihan]ASP.NET MVC 5 – Kode Pertama
Tinggalkan Komentar