独有属性ASP.NET标识 [英] Unique properties ASP.NET Identity

查看:79
本文介绍了独有属性ASP.NET标识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用visual studio 2013开发一个WEB API asp.net项目,我正在实现自定义身份模型以进行自定义注册。例如,我在RegisterBindingModel中添加了一个电子邮件字段。



这就是我所做的:如何扩展asp.net web api 2用户?



我需要用户添加一个唯一的电子邮件,但默认情况下该字段可以重复。我的问题是如何使这个电子邮件属性与Username一样独特?我已经读过可以使用UserValidator设置唯一属性,但无法找到。你能用UserValidator或者最好的方式告诉我如何做到这一点吗?



用户名如何定义为唯一?我无法在任何地方找到它。



谢谢。

I'm developing a WEB API asp.net project with visual studio 2013, and I'm implementing my custom Identity model for custom registration. For example I've added an email field in the RegisterBindingModel.

This is what I've done: How to extend asp.net web api 2 user?

I need that the user add an unique email, but by default that field can be repeated. My question is how do I make this email property unique, like Username? I've read that unique properties can be set with UserValidator, but can't find how. Can you tell me how I can make that, with UserValidator or the best way?

And how's the Username defined as unique? I can't find it anywhere.

Thank you.

推荐答案

您可以参考以下文章使用ASP.NET标识添加额外的属性:



使用ASP.NET标识添加数据
You can refer the following article to add an extra property using ASP.NET Identity:

Adding Data using ASP.NET Identity


这篇关于独有属性ASP.NET标识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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