'DbContext error when scaffolding Identity in Blazor Server app

I'm learning Blazor Server and have an app with an existing DbContext (EF/MSSQL) for CRUD operations.

Now I'd like to implement Identity and for that I'm following this guide. I'm on Visual Studio for Mac, so I use the CLI commands.

My error occurs when running this command: dotnet aspnet-codegenerator identity -dc MyApp.Data.Models.DBContext --files "Account.Register;Account.Login"

It says:

DbContext type 'DBContext' is found but it does not inherit from 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext'

That's obviously true, but what then? Create another DbContext that inherits from IdentityDbContext and use that instead?

The end result should be, that when I'm done with the migration part, the database tables for the Identity (users, roles and so on) are created in my existing database.

If you need some specific code parts from my app, please let me know.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source