View Single Post
  #1 (permalink)  
Old December 4th, 2012, 05:58 PM
jkennedy jkennedy is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 - Error Creating StoreManager

On Chapter 4, page 74 I'm creating the StoreManager Controller as described and I've created the classes for Album, Artist and Genre as described earlier, on the Add Controller dialog I've selected the Template "MVC controller... using EF", Model Class is "Album" and I've defined a new Data context class.

When I click Add I get the following error...

"Unable to retrieve metadata for 'MMS.Album'. One or more validation errors were detected during model generation:

- System.Data.Entity.Edm.EdmEntityType : EntityType 'Album' has no key defined. Define the key for this EntityType.
- System.Data.Entity.Edm.EdmEntitySet: EntityType: EntitySet 'Albums' is based on type 'Album' that has no keys defined."

I thought EF derived Primary keys based on the class properties definition?