Skip to content

Instantly share code, notes, and snippets.

@gmartinezsan
Created May 9, 2018 04:14
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 gmartinezsan/9f4dabd07622e1628a1c32335696d074 to your computer and use it in GitHub Desktop.
Save gmartinezsan/9f4dabd07622e1628a1c32335696d074 to your computer and use it in GitHub Desktop.
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
{
services.AddDbContext<BooksCatalogDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}
else
{
services.AddDbContext<BooksCatalogDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("AzureConnection")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment