【发布时间】:2017-10-24 12:31:56
【问题描述】:
根据在其他地方阅读的建议,即角色是声明的子集,我正在寻找一种干净的方法来要求 ASP.NET Identity 中的 EF Core 实现不要在 ASP.NET Identity Core 2.0 中创建与角色相关的表VS 2017 中的模板。只需要声明。 模板使用
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
而 IdentityDbContext 会创建这些 Roles 相关的表
如何在不操作迁移文件的情况下摆脱它们?
【问题讨论】:
标签: asp.net-identity asp.net-core-2.0 ef-core-2.0