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 just need columns Id, SecurityStamp and UserName. Only post, that I've found is here: AspNet Identity 2.0 Email and UserName duplication , but it is still unsloved (due to error in Santosh comment).
So can anybody tell my how to solve this?
EDIT: Is it even possible to delete some of these columns/properties?
Thanks
Actually you can ignore the fields, just you need to configure your entity OnModelCreating within your context Class as:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>().Ignore(c => c.AccessFailedCount)
.Ignore(c=> c.LockoutEnabled)
.Ignore(c=>c.LockoutEndDateUtc)
.Ignore(c=>c.Roles)
.Ignore(c=>c.TwoFactorEnabled);//and so on...
modelBuilder.Entity<IdentityUser>().ToTable("Users");//to change the name of table.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With