Hello all!
I'm trying to implement Identity and code first on a web application. Let's say I have a table Orders and I want the Id of the user to be in it. How do I declare in my Order class? I've extended the AspNetUser class to my own user class. Would it be like:
public class Order{[Key]
public int Id { get; set; }
public string AspNetUserId { get; set; }
[
ForeignKey("AspNetUserId")]
public MyAppUser User{ get; set; }
}
Do I have to declare the AspNetUserId in order to the entity framework create the field in the database so it is a ForeignKey?
Thank you in advance.