gpt4 book ai didi

c# - 从 Identity.EntityFramework IdentityUser 中排除属性

转载 作者:太空宇宙 更新时间:2023-11-03 15:16:03 25 4
gpt4 key购买 nike

我有以下类(class)

public class AppUser : Microsoft.AspNet.Identity.EntityFramework.IdentityUser<int, AppLogin, AppUserRole, AppClaim>
{
public AppUser()
: base()
{
}

public System.DateTime DateCreated { get; set; }
public DateTime? LastActivityDate { get; set; }
}

我不想从基类向数据库发送一些值,例如“TwoFactorEnabled”、“PhoneNumberConfirmed”等。

但我不能从数据库中排除 then 因为 Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext不允许我覆盖 OnModelCreating .

那么,我怎样才能从我的 dbcontext 中排除这些属性呢? ?

最佳答案

我自己找到了答案。 IdentityDbContext 类有一个名为 OnModelCreating 的 protected 方法(类似于 DbContext 类)。我设法排除了我想要的值

关于c# - 从 Identity.EntityFramework IdentityUser<TKey, Login, TRole, T Claim> 中排除属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39063702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com