Skip to content

Instantly share code, notes, and snippets.

@alefra88
Created July 30, 2024 17:49
Show Gist options
  • Save alefra88/09092f6fa67cb2009c1f5cf35c6e686e to your computer and use it in GitHub Desktop.
Save alefra88/09092f6fa67cb2009c1f5cf35c6e686e to your computer and use it in GitHub Desktop.
Constructor que recibe cadena de conexión desde appsettings.json y que usa el objeto ConfigurationBuilder
//En el método constructor se cargará la URL de la web api que se especifico en appsettings.json
//para esto se utiliza un objeto ConfigurationBuilder
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
_urlWebAPI = builder.GetSection("urlWebAPI").Value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment