No DbContext named 'PersistedGrantDbContext' was found Exception
Steps to reproduce the issue:
- have an existing ASP.NET Core 2 MVC app for the identity server
- created a new .NET Core class library to have the DAL logic in it and installed the following packages in it:
IdentityServer4.EntityFrameWorkIdentityServer4.AspNetIdentityMicrosoft.EntityFrameWorkCoreMicrosoft.EntityFrameWorkCore.Tools - Added the below snippet before the end element in the class library:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
- and then tried to run the following migration command
dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
Expected A migration folders created for the PresistedGrantDbContext
Actual No DbContext named 'PersistedGrantDbContext' was found
I have tried to clean the solution and rebuild it and even creating another class library but the same issue happen.
IIRC, migrations don't work for library projects. In any event, that's a microsoft feature, not an IdentityServer feature so I'd look to them for help with it.
All set on this issue -- can we close?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.