ASP.NET标识不向创建的用户添加密码

时间:2015-07-08 13:50:06

标签: asp.net f# asp.net-identity

我正在自己实现IUserPasswordStore<TUser,TKey>,阅读和创建操作正常。除了UserManager.Create(TUser,Password)重载不添加任何密码。我对它应该如何实现有点不确定,我猜想重载会调用IUserPasswordStore.CreateAsync然后调用IUserPasswordStore.SetPasswordHashAsync但是情况似乎并非如此。它只会调用前一种方法,即使使用重载提供密码也不会设置密码。

以下是我IUser<TKey>的实现:

[<AllowNullLiteral>]
type ApplicationUser(id, email) =
    member __.Id = id
    member __.Email = email
    member val PasswordHash = Unchecked.defaultof<string> with get,set
    new(email) = ApplicationUser(0, email)
    interface IUser<int> with
        member __.Id = id
        member val UserName = email with get,set

IUserPasswordStore.CreateAsync只是针对数据库运行此查询:

INSERT INTO dbo.Users(Email,PasswordHash) VALUES (@email, @pwHash)

0 个答案:

没有答案