I have an app I'm building where each of the data entry tables (account, contact) have a field for the owner of the record. The owner is not necessarily the one who is logged into the app. I want to provide a dropdown list of the ApplicationDBContext users in the account and contact views. When I run update-database from PM I get;
THXData.Models.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType. THXData.Models.IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType. Contact_Owner_Target_Contact_Owner_Source: : The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'OwnerId' on entity 'Contact' does not match the type of property 'Id' on entity 'ApplicationUser' in the referential constraint 'Contact_Owner'. 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.
public partial class Contact
{
[Key]
public int ID { get; set; }
[Required]
[DataMember]
public string Name { get; set; }
[DataMember]
public int OwnerId { get; set; }
[ForeignKey("OwnerId")]
[Display(Name = "Owner")]
public virtual ApplicationUser Owner { get; set; }
/* other fields... */
}