Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

MVC Core Default identity relationship Entity Framework

$
0
0

I am using MVC Core with the default individual user authentication. I added FullName field to AspNetUsers Table and it is working fine. I need to create a relationship between my tables to the id field in the AspNetUsers table so I can get the fullname of the user.

I have no idea on how to create relationship in Entity framework, I tried to add the following in the ApplicationUser Class

public class ApplicationUser : IdentityUser
{
    public string FullName { get; set; }

    public mytable T { get; set; }
}

and

in mytable model, I added the following

public virtual ICollection<ApplicationUser> ApplicationUser { get; set; }

unfortunately, I am getting the following error:

The entity type 'IdentityUserLogin' requires a primary key to be defined

any idea?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>