IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

No DbContext named 'PersistedGrantDbContext' was found Exception

Open MostafaAbdlrazek opened this issue 8 years ago • 3 comments

Steps to reproduce the issue:

  1. have an existing ASP.NET Core 2 MVC app for the identity server
  2. created a new .NET Core class library to have the DAL logic in it and installed the following packages in it: IdentityServer4.EntityFrameWork IdentityServer4.AspNetIdentity Microsoft.EntityFrameWorkCore Microsoft.EntityFrameWorkCore.Tools
  3. Added the below snippet before the end element in the class library:

<ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" /> </ItemGroup>

  1. 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.

MostafaAbdlrazek avatar Jun 04 '18 11:06 MostafaAbdlrazek

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.

brockallen avatar Jun 04 '18 16:06 brockallen

All set on this issue -- can we close?

brockallen avatar Jun 19 '18 17:06 brockallen

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.

lock[bot] avatar Jan 13 '20 07:01 lock[bot]