0

When I try to add a new controller using scaffolding, I get this message

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

Can anyone help? This is the Model use for scaffolding

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; }
    }

1 Answer 1

1
public class Patient
{
    [Key]
    public int PatientId { get; set; }
    public string FirstName { get; set; }
    public String LastName { get; set; } ==> Replace String by string with a lower case
    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; }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.