Elena Glibart
Total Post:42
Points:296
I'm going in circles with either an in valid context type or undefined entity key. I have attached a copy of the longer error message. Just trying to create a test application that is connected to an existing db.

Here is the code - thanks in advance
public class TestPerson
{
int ID { get; set; }
string FirstName { get; set; }
string LastName { get; set; }
string Hair { get; set; }
string Race { get; set; }
string Measurements { get; set; }
}
public class TestPersonContext : DbContext
{
public DbSet<TestPerson> TestPersons { get; set; }
}
Post:145
Points:1019Re: Scaffolding error in asp.net mvc?
You should set one of your properties as the primary key. In your case this will be the ID property:
Btw why are all your properties private? It would be recommended to make all them publicly available, especially the primary key.
What is more there is something called Convention over Configuration which is used quite intensively in Entity Framework. One of the conventions is the Primary Key Convention which states: