gpt4 book ai didi

asp.net - 扩展成员(member) API、MembershipUser

转载 作者:行者123 更新时间:2023-12-03 01:55:32 27 4
gpt4 key购买 nike

我创建了自己的数据库架构来存储用户信息。

CREATE TABLE [dbo].[MyCustomMembership_Users](
[UserId] [uniqueidentifier] NOT NULL,
[UserName] [nvarchar](256) NOT NULL,
[LoweredUserName] [nvarchar](256) NOT NULL,
[MobileAlias] [nvarchar](16) NULL,
[IsAnonymous] [bit] NOT NULL,
[LastActivityDate] [datetime] NOT NULL,
[FirstName] [nvarchar](256) NULL,
[MiddleName] [nvarchar](256) NULL,
[LastName] [nvarchar](256) NULL)

然后,我扩展 MembershipProvider 和 MembershipUser 并创建重写方法。当我调用 CreateUser 方法时,如何传递附加信息? 我知道我可以使用配置文件来实现此目的,但我也希望能够这样做,如果结果太复杂的是我会走个人资料路线。

public class MyMembershipProvider : MembershipProvider
{
public override MembershipUser CreateUser(string username, string password,
string email, string passwordQuestion, string passwordAnswer, bool isApproved,
object providerUserKey, out MembershipCreateStatus status)
{
throw new NotImplementedException();
}
}
public class MyMembershipUser : MembershipUser
{
private string _firstName;
public string FirstName { get { return _firstName; } set { _firstName = value; } }

private string _middleName;
public string MiddleName { get { return _middleName; } set { _middleName = value; } }

private string _lastName;
public string LastName { get { return _lastName; } set { _lastName = value; } }

public MyMembershipUser() : base()
{
this.FirstName = _firstName;
this.MiddleName = _middleName;
this.LastName = _lastName;
}
}

最佳答案

您可以在providerUserKey对象中传递MyMembershipUser

关于asp.net - 扩展成员(member) API、MembershipUser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/538059/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com