C
C#13mo ago
DaisyDysie

How do I utilize Identity Framework and AspNetUser Table?

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?
2 Replies
Angius
Angius13mo ago
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
DaisyDysie
DaisyDysieOP13mo ago
Thank you so much! 🙏
Want results from more Discord servers?
Add your server