Error:
DBContext type 'MvcMovieContext' is found but it does not inherit from Microsoft.ASPNetCore.Identity.EntityFrameworkCore.IdentityDBContext
The process I have followed using latest upgrade of Visual Studio 2019: latest relevant & other packages installed (showing Nuget Solution)
- Microsoft.AspNetCore.Identity.EntityFrameworkCore 5.0.6
- Microsoft.EntityFrameworkCore.SqlServer 5.0.6
- Microsoft.AspNetCore.Identity.UI 5.0.6
- Microsoft.EntityFrameworkCore.Design 5.0.6
- Microsoft.EntityFrameworkCore.Tools 5.0.6
StartUp.cs
using Microsoft.EntityFrameworkCore;
using MvcMovie.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddDbContext<MvcMovieContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("MvcMovieContext")));
}
After specifying Identity scaffolding template
keep ~Views\Shared_Layout.cshtml page
database context class specified as MvcMovie.Data.MvcMovieContext
no files overwritten
no user class specified
ok
process updates dependencies
builds solution until error
I have reviewed similar issues here and github. The closest I (newbie) could find was UseSqlServer() method is missing from Microsoft.EntityFrameworkCore.SqlServer
I have looked through the build files of the working MvcMovie solution. I have updated dependencies. If someone could tell me how to troubleshoot why a DBContext type "does not inherit from Microsoft.ASPNetCore.Identity.EntityFrameworkCore.IdentityDBContext" then I would be much obliged.
public class MvcMovieContext : DbContext, whereDbContextshould beIdentityDbContext. I don't know if you'll experience any further errors, but that should address this particular error at least.DbContexttoIdentityDbContextas @MattU said?