Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Last active December 22, 2019 21:16
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 ankitvijay/51c24a04d6e71c6c0ac3313663098f7a to your computer and use it in GitHub Desktop.
Save ankitvijay/51c24a04d6e71c6c0ac3313663098f7a to your computer and use it in GitHub Desktop.
Startup.cs
public class Startup
{
private readonly IConfiguration _configuration;
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
var deployment = _configuration["Deployment"];
var connectionString = _configuration["ConnectionString"];
// Code removed for brevity
if (deployment == "Azure")
{
// Inject SQL Server dependency
}
else
{
// Inject MySQL dependency
}
}
// Code removed for brevity
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment