PersistedGrantDbContext issue
sanpunind opened this issue · comments
following command doesn't create respective entities into database , also I don't see consent page after login ,
AuthServer.Infrastructure> dotnet ef database update --context PersistedGrantDbContext
Please suggest
Do you receive an exception when running this?
The same issue with standalone SQL Server.
I have changed appsettings connection string (CS). But it is still present for second migration.
Fix the next lines with the correct CS:
public PersistedGrantDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlServer("Server=(localdb)\mssqllocaldb;Database=AuthServer;Trusted_Connection=True;MultipleActiveResultSets=true",
sql => sql.MigrationsAssembly(typeof(PersistedGrantDbContextFactory).GetTypeInfo().Assembly.GetName().Name));
return new PersistedGrantDbContext(optionsBuilder.Options, new OperationalStoreOptions());
}
Resolved as so:
This exception occurs because one might not have adjusted their "Connection String" as one did in the two of "appsettings.json".
The adjustment made there needs to be done in the connection string in this class.
This is the syntax just in case for those who are still skeptical
Server=ServerName;Database=DatabaseName;Trusted_Connection=True;