Skip to content
Discussion options

You must be logged in to vote

GetUserAsync() gives you the user entity, but Identity does not guarantee that all values should be read directly from it. UserManager.GetUserNameAsync() and GetPhoneNumberAsync() exist so stores can:

  • compute values dynamically
  • map them from non-standard storage
  • apply normalization / indirection
  • support custom user stores that don’t expose fields directly

In the default EF Core store, those methods do just return user.UserName and user.PhoneNumber, so your version works today. The template uses the UserManager methods to stay store-agnostic and future-proof.

For your custom user properties:

  • If they’re simple scalar fields → read them directly from user
  • Only add Get…Async methods if the…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mnbob70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants