Reputation: 2655
I've recently updated the asp.net identity and now I can't login because it says that it requires new fields, so I tried to recreated the tables and the table users seems to have some extra fields, which I basically do not need.
These fields are: phonenumber, phonenumberconfirmed, twofactorenabled, etc etc ... how can I disable those fiends and say to asp.net identity to not even look for them? Because if I delete them, then I get errors saying it could not find those fields.
Upvotes: 2
Views: 1958
Reputation: 1189
One way of doing what you want is you would need to implement your own custom user storage classes, like IdentityUser
, UserStore
etc... You can find more info here.
Upvotes: 0
Reputation: 1060
You can disable the fields you don't need by ignoring their mapping in the DbContext class. For example if you don't want to use the PhoneNumber and PhoneNumberConfirmed you can ignore them in the ApplicationDbContext as below
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<ApplicationUser>().Ignore(x => x.PhoneNumber);
modelBuilder.Entity<ApplicationUser>().Ignore(x => x.PhoneNumberConfirmed);
}
Note that not mapping these fields would lead to not using APIs that use them consequently missing out those features.
Upvotes: 3