[英]Simple Membership: can I create a user without referencing webmatrix?
I have my restrictions to not to reference webmatrix here. 我有限制不在这里引用webmatrix。
I want to create a user record in membership tables of simple membership (using EF 5). 我想在简单成员资格的成员资格表中创建用户记录(使用EF 5)。 To make it easier, I have mapped EF Models to those tables.
为了更容易,我已将EF模型映射到这些表。
Is it possible to with code without webmatrix ? 没有webmatrix的代码是否可能?
I don't want to use any membership provider. 我不想使用任何会员提供者。
The system uses simple membership. 系统使用简单的成员资格。 I don't want to change that.
我不想改变这一点。 From a separate project, I want to add a user to that database without referencing WebMatrix.
在一个单独的项目中,我想在不引用WebMatrix的情况下将用户添加到该数据库。 Is that possible ?
那可能吗 ?
使用标准的ASP.NET成员资格,您可以使用System.Web.Security.Membership.CreateUser创建新用户。
No, you cannot use SimpleMembership without WebMatrix as SimpleMembership lives in the WebMatrix namespace. 不,没有WebMatrix就不能使用SimpleMembership,因为SimpleMembership存在于WebMatrix名称空间中。
You can, however, use any number of other membership providers, such as the original SqlMembershipProvider, the Universal Providers, or any number others that are available. 但是,您可以使用任意数量的其他成员资格提供程序,例如原始SqlMembershipProvider,Universal Providers或任何其他可用的成员资格提供程序。
EDIT: 编辑:
Yes, you can add a user to the database manually. 是的,您可以手动将用户添加到数据库。 In the comments below I have included a link to the source for SimpleMembershipProvider.cs, examine that code and use the same methods in your own project.
在下面的评论中,我已经包含了一个指向SimpleMembershipProvider.cs源代码的链接,检查该代码并在您自己的项目中使用相同的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.