How to make EF-Core use a Guid instead of String for its ID/Primary key

You need custom ApplicationUser inherit from IdentityUser<TKey> and custom Role inherit from IdentityRole<TKey> public class ApplicationUser : IdentityUser<Guid> { } public class Role : IdentityRole<Guid> { } Custom context class inherit from IdentityDbContext<ApplicationUser, Role, TKey> and use fluent api for auto generate guid keys. public class ApplicationDbContext : IdentityDbContext<ApplicationUser, Role, Guid> { protected override void … Read more

How to create roles in ASP.NET Core and assign them to users?

My comment was deleted because I provided a link to a similar question I answered here. Ergo, I’ll answer it more descriptively this time. Here goes. You could do this easily by creating a CreateRoles method in your startup class. This helps check if the roles are created, and creates the roles if they aren’t; … Read more

‘No database provider has been configured for this DbContext’ on SignInManager.PasswordSignInAsync

If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions object in its constructor and passes it to the base constructor for DbContext. The error message says your DbContext(LogManagerContext ) needs a constructor which accepts a DbContextOptions. But I couldn’t find such a constructor in your DbContext. So adding the below … Read more