Skip to content

Instantly share code, notes, and snippets.

@ngohungphuc
Last active December 11, 2018 08:40
Show Gist options
  • Save ngohungphuc/aa1ebb290a4e84bdb7a33ebff3b6d2a9 to your computer and use it in GitHub Desktop.
Save ngohungphuc/aa1ebb290a4e84bdb7a33ebff3b6d2a9 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
const string connectionString = @"Data Source=IdentityServer.db;";
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddDbContext<ApplicationDbContext>(builder =>
builder.UseSqlite(connectionString, sqlOptions => sqlOptions.MigrationsAssembly(migrationsAssembly)));
services.AddIdentity<IdentityUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddIdentityServer()
//Configures EF implementation of IPersistedGrantStore with IdentityServer.
.AddOperationalStore(options =>
options.ConfigureDbContext = builder =>
builder.UseSqlite(connectionString, sqlOptions => sqlOptions.MigrationsAssembly(migrationsAssembly)))
//Configures EF implementation of IPersistedGrantStore with IdentityServer.
.AddConfigurationStore(options =>
options.ConfigureDbContext = builder =>
builder.UseSqlite(connectionString, sqlOptions => sqlOptions.MigrationsAssembly(migrationsAssembly)))
.AddAspNetIdentity<IdentityUser>()
.AddDeveloperSigningCredential();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment