相关疑难解决方法(0)

错误:"Id字段是必需的." 使用AspNet.Identity 2.0在数据库中注册新用户时

欢迎,

我在Asp.Net mvc应用程序中创建(注册)新用户时遇到了主题中提到的验证错误,我在我的自定义ApplicationUser类中使用了Asp.Net Identity

public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>
{
    public async Task<ClaimsIdentity>
    GenerateUserIdentityAsync(ApplicationUserManager manager)
    {      
        var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);   
        return userIdentity;
    }

    public virtual string EmailConfirmedChar { get; set; }

    public virtual string PhoneNumberConfirmedChar { get; set; }

    public virtual string TwoFactorEnabledChar { get; set; }

    public virtual string LockoutEnabledChar { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

在我的TKey是字符串,所以我希望IdGuid因为它是默认的.

当然我实现了我的自定义UserStore,UserManager等,一般来说我的灵感来自博客文章使用Entity Framework Fluent API定制ASP.NET身份数据模型

我做错了什么?下载此博客文章中附带的示例时,通常会出现相同的验证错误.

相关或不,我使用Firebird数据库.

c# asp.net-mvc entity-framework-6 asp.net-identity

2
推荐指数
1
解决办法
1643
查看次数