Hi Folks,
If Mr Galloway and Co are reading, I'm thoroughly enjoying your book. Just a quick query please.
1. Is there a reason we create a new db context instead of using the existing ApplicationDbContext?
2. I want to stamp any changes to an album with a userID so added the following to the Album class.
Code:
public virtual ApplicationUser SubmittedBy { get; set; }
public virtual ApplicationUser ModifiedBy { get; set; }
but when I try to add a controler as per p87 in the book I get the below error, even after cleaning, building and rebuilding the project.
I also added the following to ApplicationUser class to try to resolve the issue but no joy
Code:
[Key]
public virtual int ApplicationUserId { get; set; }
Could the issue be that the IdentityModels with their own DbContext are in the same folder as the rest of my models?
Code:
There was an error running the selected code generator:
'Unable to retrieve metadata for 'MvcMusicStorePrototype.Models.Album'.
One or more validation errors were detected during model generation:
IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.
IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.
IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined.
IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.
'