aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 870 forks source link

Why isn't there a FindByNormalizedName method? #1879

Closed postb99 closed 6 years ago

postb99 commented 6 years ago

Hello,

I'm reading UserManager and RoleManager API documentation. I've understood the usefulness of normalized name/email, to have consistent comparison, maybe also a uniqueness value check.

Why aren't there FindByNormalizedNameAsync (UserManager and RoleManager) and FindByNormalizedEmail (UserManager) methods?

Thanks for information.

HaoK commented 6 years ago

Because the managers already treat them as case insensitive, what are you trying to do?

Xarkam commented 6 years ago

@HaoK if the managers treat them as case insensitive, where is the interest to have a normalized field in database ?

postb99 commented 6 years ago

Thanks @HaoK so this isn't clearly stated in documentation, am I wrong? So I would need to open a PR regarding documentation.

For example: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.rolemanager-1.findbynameasync?view=aspnetcore-2.1#Microsoft_AspNetCore_Identity_RoleManager_1_FindByNameAsync_System_String_

HaoK commented 6 years ago

that's how they do case insensitive searches... username = Hao, NormalizedUserName = HAO. One is for display purposes, other is for searching

postb99 commented 6 years ago

Thanks @HaoK for the definition, but this is off-topic. My feeling was that documentation should be improved, since I know databases that are case-sensitive or case-insensitive, so legitimately wondered about the identity managers, since there is no information in documentation about search being case-insensitive. Do you agree that there is a need to be explicit in documentation?

HaoK commented 6 years ago

Feel free to file an issue in https://github.com/aspnet/Docs if you feel the documentation is not sufficiently clear, I believe they are fairly open to PRs as well if you have any specific ideas about how you would like the documentation to be clearer...