2012-02-20 75 views
0

時當我嘗試使用腳手架添加一個新的控制器腳手架錯誤在ASP.Net MVC 3,我得到這個消息創建控制器

"Unable to retrieve metadata for 'Model name'. Value cannot be null. Parameter name: key" 

誰能幫助? 這是模型中使用的腳手架

public class Patient 
    { 
     [Key] 
     public int PatientId { get; set; } 
     public string FirstName { get; set; } 
     public String LastName { get; set; } 
     public int Phone { get; set; } 
     public int FamilyPhone1 { get; set; } 
     public int FamilyPhone2 { get; set; } 
     public string Address { get; set; } 

     public virtual ICollection<Drug> Drugs { get; set; } 
     public virtual ICollection<Test> Tests { get; set; } 
     public virtual ICollection<Alert> Alerts { get; set; } 
     public virtual ICollection<Message> Messages { get; set; } 
    } 

回答