【问题标题】:Mapping of AspNetUsers and IdentityUserAspNetUsers 和 IdentityUser 的映射
【发布时间】:2016-10-24 07:13:14
【问题描述】:

无法理解 IdentityUser 是如何映射到 AspNetUsers 的,就像没有 IdentityUser 上方的 [Table] 属性,因此 EF 如何知道该表是 AspNetUsers。

我的代码

  public class ApplicationUser : IdentityUser
  {
    public string FirstName { get; set; }  
  }

【问题讨论】:

    标签: entity-framework-4 asp.net-identity


    【解决方案1】:

    ASP.NET Identity 带有一些默认表,例如用户、角色、登录等。这些表由 IdentityUser、IdentityRole、IdentiyLogin 等类定义。

    您的ApplicationUser 派生自IdentityUser,这就是EF 知道这是[dbo].[AspUser] 表的原因。所有这些身份类别都可以扩展,就像您所做的那样。只需继承它们并添加其他属性即可。

    这里是official website。有一个有据可查的介绍视频 abot he ASP.NET Identity。看看吧。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-05
      • 1970-01-01
      • 2012-07-11
      • 1970-01-01
      • 2018-09-16
      • 2018-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多