I'm updating an ASP.NET Core project from 2.2 to 3.1. I've sorted out everything else using the migration docs, but it looks like UserManager<TUser>.NormalizeKey(String)
has just disappeared after v2.2, and I can't find any migration docs around it.
From what I can tell it does not seem necessary to use. But I'm not sure and we have it sprinkled around everywhere.
For posterity, the error is: The name 'NormalizeKey' does not exist in the current context
My code is something like:
public virtual async Task<IdentityResult> AddToRequestedRoleAsync(ApplicationUser user, string role)
{
if (user == null) {
throw new ArgumentNullException(nameof(user));
}
var normalizedRole = NormalizeKey(role);
}
In later versions of .NET Core,
NormalizeKey
has been replaced byNormalizeEmail
andNormalizeName
.You may not need to normalize, since
FindByEmailAsync
will normalize the parameter for you.