I was combining my existing DBContext with the new IdentityDbContext in MVC 5. I managed to combine the two contexts but when I ran my application and the model was being created I was presented with the following error message:
Context.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType. Context.IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.
Don't bother with the configuration classes.
I worked out how to fix it after doing a bit of reading.
Create the two following configuration classes (keeps it clean in your OnModelCreating method as your database grows and relationships between tables increase)
In the OnModelCreating method within your Applications DbContext add the two configurations outlined above to the model:
This should now get rid of the error methods when your model is being created. It did for me.