【问题标题】:How can I omit certain fields of IdentityUser object如何省略 IdentityUser 对象的某些字段
【发布时间】:2017-11-15 11:54:01
【问题描述】:
  • 身份用户字段

    public virtual bool PhoneNumberConfirmed { get; set; } public virtual bool TwoFactorEnabled { get; set; } public virtual string SecurityStamp { get; set; } public virtual DateTime? LockoutEndDateUtc { get; set; }

【问题讨论】:

  • 您的问题不清楚。你到底想达到什么目的
  • 你想实现什么,从数据库标识表和 IdentityUser 类中删除一些列?从第三方包库中删除字段?在这种情况下,您可能必须开发可以从此类继承的身份类,并且可能您可以隐藏基列,但 c# 不允许这样做。也可以参考stackoverflow.com/questions/25559878/…、stackoverflow.com/questions/106383/…

标签: asp.net asp.net-identity


【解决方案1】:

忽略来自 IdentityUser 的所需字段

   modelBuilder.Entity<IdentityUser>().Ignore(c => c.PhoneNumberConfirmed )
                                           .Ignore(c=> c.TwoFactorEnabled )
                                           .Ignore(c=>c.SecurityStamp )
                                           .Ignore(c=>c.LockoutEndDateUtc 

【讨论】:

  • 谢谢 Anil...让我试着 ping 你。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-15
  • 1970-01-01
  • 2017-06-28
  • 1970-01-01
  • 2018-12-10
  • 1970-01-01
  • 2022-01-16
相关资源
最近更新 更多