It may looks like a copy of already asked question. i have checked all the solutions but my problem is non-logical.
public class Breed
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
int id { get; set; }
string name { get; set; }
}
Error Kamdhenu.Models.Breed: : EntityType 'Breed' has no key defined. Define the key for this EntityType. Breeds: EntityType: EntitySet 'Breeds' is based on type 'Breed' that has no keys defined.
Define the properties as
public
. Without specifier they areprivate
by default and EF won't recognize and map private properties: