Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active November 3, 2016 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/a4310da2c97197448f63041213ed8b94 to your computer and use it in GitHub Desktop.
Save dcomartin/a4310da2c97197448f63041213ed8b94 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
// Add EF services to the services container
if (_platform.UseInMemoryStore)
{
services.AddDbContext<MusicStoreContext>(options =>
options.UseInMemoryDatabase());
}
else
{
services.AddDbContext<MusicStoreContext>(options =>
options.UseSqlServer(Configuration[StoreConfig.ConnectionStringKey.Replace("__", ":")]));
}
// Add Identity services to the services container
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.Cookies.ApplicationCookie.AccessDeniedPath = "/Home/AccessDenied";
})
.AddEntityFrameworkStores<MusicStoreContext>()
.AddDefaultTokenProviders();
services.AddMediatR(typeof(Startup).GetTypeInfo().Assembly);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment