SimpleMemberShipProvider,使用自定义数据库表的多个PropertyValues [英] SimpleMemberShipProvider, Using multiple PropertyValues with custom Database tables

查看:230
本文介绍了SimpleMemberShipProvider,使用自定义数据库表的多个PropertyValues的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在方案中使用MVC4 SimpleMembershipProvider 创建日志。我想比我的开箱即用 AccountControl 中得到一点更多的控制。所以,我已经修改了用我的数据库和表的连接,不过,我想喜欢姓,名和电子邮件字段是必需的。

I am creating a Log in scheme using SimpleMembershipProvider in MVC4. I wanted a little more control than what i get with the out of the box AccountControl. So I have modified the connections to use my database and table, however I would like fields like first name, last name and email to be required.

WebSecurity.CreateUserAndRole(username, password);

失败,因为所需的字段类型。我发现,我可以使用 PropertyValues​​ 来解决这个问题,但是我无法弄清楚如何使 PropertyValues​​ 等于多不是一个值。

fails because of the required field types. I have found that I can use PropertyValues to fix this issue, however I cannot figure out how to make PropertyValues equal more than one value.

WebSecurity.CreateUserAndAccount(user.Username, user.password, propertyValues: new {firstName = user.firstName});

我如何去使用多个 PropertyValues​​

推荐答案

我不知道,但你能也许尝试添加一个条目到新{} 对象你创建。是这样的:

I'm not sure, but can you maybe try adding another entry to the new {} object you're creating. Something like:

WebSecurity.CreateUserAndAccount(user.Username, user.password,
                                 propertyValues: new {firstName = user.firstName,
                                                      lastName = user.lastName});

这篇关于SimpleMemberShipProvider,使用自定义数据库表的多个PropertyValues的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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