I have removed the "AspNetUserClaims" table from my DB because I am not saving any claims information.
After creating a user I am trying to fetch user info by its user name and it returns an error:
"Invalid object name 'dbo.AspNetUserClaims'.".
IdentityResult result = await manager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
var userInfo = manager.FindByName(user.UserName);
foreach (var myRole in myRoles)
{
manager.AddToRole(userInfo.Id, myRole.Name);
}
await AddToPreviousPasswordsAsync(user, user.PasswordHash);
}
In the UserManager class of Identity 2, the Entity Framework-backed UserStore will ensure the claims are loaded for the requested user.
This accesses the AspNetUserClaims table, which will throw an exception when your database doesn't contain that table.
Simply don't remove tables that are required by a library, or rebuild the library without the claims part. And you don't want to do the latter, because then you won't receive any updates from the official channel anymore, and have to manually patch it. This is no way to handle a security-related library, or generally any library for that matter.