I upgraded from .NET Core 1.1 to .NET Core 2.0 and encountered the following issue (I also upgraded a few libraries to support .net core 2.0 aswell)
CS1929 'ConfigurationStoreOptions' does not contain a definition for 'UseNpgsql' and the best extension method overload 'NpgsqlDbContextOptionsExtensions.UseNpgsql(DbContextOptionsBuilder, string, Action)' requires a receiver of type 'DbContextOptionsBuilder'
Startup.cs
services.AddIdentityServer()
.AddSigningCredential(Certificate.Get())
.AddAspNetIdentity<User>()
.AddConfigurationStore(builder =>
builder.UseNpgsql(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseNpgsql(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)));
Same issue when using UseSqlServer
// configure identity server with in-memory users, but EF stores for clients and resources
services.AddIdentityServer()
.AddTemporarySigningCredential()
.AddTestUsers(Config.GetUsers())
.AddConfigurationStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)))
.AddOperationalStore(builder =>
builder.UseSqlServer(connectionString, options =>
options.MigrationsAssembly(migrationsAssembly)));
http://docs.identityserver.io/en/release/quickstarts/8_entity_framework.html
Note: I have added "using Microsoft.EntityFrameworkCore;"
Solution:
services.AddIdentityServer()
.AddSigningCredential(Certificate.Get())
.AddAspNetIdentity<User>()
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseNpgsql(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
})
// this adds the operational data from DB (codes, tokens, consents)
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseNpgsql(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
// this enables automatic token cleanup. this is optional.
options.EnableTokenCleanup = true;
options.TokenCleanupInterval = 30;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With