Categories
ASP.NET Development Programming & Design

When using ASP.NET core Identity, it is better to extend the User class or write separate entities that relate to it [on hold]

I want to use the Identity system provided by ASP.NET core. Most tutorials I read extend the User class by adding custom properties like the following:

public class ApplicationUser : IdentityUser
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    // etc...
}

This seems fine when you only have few properties. But what if I want to add a long list of other properties, like their full address, their memberships, etc.

From a design perspective, is it better (and even possible) to write separate entities that store these custom properties and in the ApplicationUse class add navigation properties that can be used to access these entities, like this:

public class ApplicationUser : IdentityUser
{
    public Address Address { get; set; }
    public IEnumerable<Membership> Memberships { get; set; }
    // Other navigation properties
}

How do most professional developers approach this? I am new to programming and learning it in my spare time to land a job in software development.

Leave a Reply

Your email address will not be published. Required fields are marked *