ASP.NET Identity remove column from AspNetUsers table

后端 未结 5 794
轻奢々
轻奢々 2021-01-31 21:12

When I use ASP.NET Identity first code approach, I want to generate columns in AspNetUsers table in my own way. I don\'t need to have stored multiple columns with null values. I

5条回答
  •  一生所求
    2021-01-31 21:46

    Actually you can, just configure your entity on OnModelCreating of your context class.

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity().Ignore(u => u.AccessFailedCount);
        //and so on...
    }
    

    Or if your application has a separate file for each configuration (wich is what i recommend), you can do like this:

    public class ApplicationUserEntityTypeConfiguration : EntityTypeConfiguration
    {
        public ApplicationUserEntityTypeConfiguration()
        {
            Ignore(p => p.AccessFailedCount);
            //And so on..
        }
    }
    

提交回复
热议问题