-
Why does OnInitializedAsync retrieve I'm going to be adding some additional members to a custom |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
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:
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:
So you’re not missing anything. The template is being conservative; your approach is perfectly fine for profile data on a custom ApplicationUser. |
Beta Was this translation helpful? Give feedback.
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:
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: