EntityType has no key defined. Define the key for this EntityType

Posted by

While running “Add-Migration” I kept receiving the following error in a new ASP.NET C# project using Entity Framework.

Ebs.Job.Models.JobListing: : EntityType ‘JobListing’ has no key defined. Define the key for this EntityType. JobListings: EntityType: EntitySet ‘JobListings’ is based on type ‘JobListing’ that has no keys defined.

The code in question was the following:

The answer is that as of 6/12/2014, Entity Framework does not support unsigned integers. Once I changed the UInt32 to Int32, everything worked great.

Leave a Reply

Your email address will not be published. Required fields are marked *