DotNet Core 中的 NormalizedUserName VS 用户名 [英] NormalizedUserName VS Username in DotNet Core

查看:16
本文介绍了DotNet Core 中的 NormalizedUserName VS 用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 MongoDB 创建 IUserLoginStore 的自定义实现,我在使用时注意到了

I'm trying to create a custom implementation of IUserLoginStore for MongoDB and I noticed when using

UserManager<ApplicationUser>

用方法

 var userResult = await _userManager.CreateAsync(user);

它通过实现

GetUserNameAsync
FindByNameAsync
SetNormalizedUserNameAsync
GetUserIdAsync

我想澄清两个问题:

  • 拥有 NormalizedUsername 和 UserName 的目的是什么?我能注意到的唯一区别是 normalizedUserName 是大写的.

  • what's the purpose of having a NormalizedUsername and a UserName? the only difference that I could notice id that the normalizedUserName is in uppercase.

我只使用我的实现来存储来自外部登录(Google plus)的用户,有没有一种方法可以省略用户名和 NormilizedUserName,因为基本上,我在这三个字段中使用电子邮件,我觉得我在复制数据,这对我来说没有任何意义.

I'm using my Implementation only to store users from an external login(Google plus), is there a way that I can omit username and NormilizedUserName since basically, I'm using the email in these three fields, I'm feeling that I'm duplicating data and it doesn't make any sense to me.

有什么建议吗?

推荐答案

1) 规范化阻止人们注册仅字母大小写不同的用户名.

1) Normalization stops people registering user names which only differ in letter casing.

2) 否 - 这些字段是基本数据模型的一部分.

2) No - those fields are part of the basic data model.

这篇关于DotNet Core 中的 NormalizedUserName VS 用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆