I'm working on a .NET Core project and I have added a custom column to the
ASPNetUsers table called DisplayName
that users set during the registration. I've successfully migrated the tables with that data and everything works fine.
However in my Login partial, I have to access the user's data through
UserManager, and there's no method of getting that DisplayName
INSTEAD of the Username
.
What do I need to do to extend the function of the "normal" Identity manager to get the custom method to retrieve the text that's stored in DisplayName
column?
By getting the current user I can then access the DisplayName
property as a normal property of an object.
var currentUser = await _UserManager.GetUserAsync(User);
var displayName = currentUser.DisplayName;