I have a model class defined like so:
public class Request
{
public int Id { get; set; }
[ForeignKey("Requester")]
public string RequesterId { get; set; }
public virtual ICollection<ApplicationUser> Requester { get; set; }
}
I'm simply making a foreign key relationship between a request and the user that made the request. However, when I try and perform an Add-Migration, I receive the following error:
Project.DataContexts.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType. Project.DataContexts.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.
I've looked around and the only similar situations are where people are using Fluent-API, with modelbinding. I'm however using data annotations. Any help on this? Thank you!