Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Luis-Palacios/65ed8315d60545439c2e to your computer and use it in GitHub Desktop.
Save Luis-Palacios/65ed8315d60545439c2e to your computer and use it in GitHub Desktop.
Chossing connection string according to Environment Variable
private static string GetConnectionString()
{
var environmentVariable = Environment.GetEnvironmentVariable("FunctionalTests");
return environmentVariable == null
? ConfigurationManager.ConnectionStrings["SchoolContext"].ConnectionString
: ConfigurationManager.ConnectionStrings["SchoolContext-FunctionalTests"].ConnectionString;
}
//Si esta setiado el valor de la variable de entorno FunctionalTests usa la base de datos para la prueba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment