【问题标题】:Newly Added Fields in AspNetUsers Table not showing up in identityUser as propAspNetUsers 表中新添加的字段未作为道具显示在 identityUser 中
【发布时间】:2018-09-16 10:01:03
【问题描述】:

请帮助我是 Asp.net Identity 的新手,这是 asp.net core 2 web api,我正在尝试将用户注册到我的 ASPNETUSER 表,并且我成功创建了新字段(名字、姓氏、地址)。

问题是每当我尝试将我的输入映射到新字段时,它甚至不会将新添加的字段显示为道具......但它会显示(即 Id、AccessfailedCount、Concurrency Stamps......)

这是我定义 ApplicationUser 的类

然后我尝试使用 ApplicationUser 而不是 IdentityUser 这一次我看到了所有的道具(我的 ApplicationUser 和 Identity User)..但是在运行它时我得到了这个错误

谢谢。

【问题讨论】:

    标签: c# asp.net-web-api asp.net-core-2.0 asp.net-identity-2


    【解决方案1】:

    您的问题是您正在创建一个 IdentityUser 实例,而不是扩展 IdentityUser 的 ApplicationUser 类的实例。

    看到这个帖子:How to extend IdentityUser with custom property

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-24
      • 2021-09-10
      • 2014-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多