C
C#

How do I utilize Identity Framework and AspNetUser Table?

How do I utilize Identity Framework and AspNetUser Table?

DDaisyDysie11/18/2023
Hello, I am building an MVC app where people will need to sign up. They can then upload stuff to the app, so I want to ensure that the relevant information is displayed respective to each user. So for example, if I have a notes table/model, do I just need to add public string? OwnerID { get; set; }? Should I also create a new model for users?
AAngius11/18/2023
Unless you want to customize the user model, then just the basic IdentityUser is fine And to create a relationship you can either reference IdentityUser, reference that and a key, or just a key and use additional configuration The customary "convention over configuration" way would be
class UploadedFile
{
// ...
public required IdentityUser Owner { get; set; }
public required string OwnerId { get; set; }
}
class UploadedFile
{
// ...
public required IdentityUser Owner { get; set; }
public required string OwnerId { get; set; }
}
Assuming IdentityUser.Id is a string of course
DDaisyDysie11/18/2023
Thank you so much! šŸ™

Looking for more? Join the community!

C
C#

How do I utilize Identity Framework and AspNetUser Table?

Join Server