public ServiceAppSettings(Dictionary <string, string> cStrings, Dictionary <string, double> intervals, OpenCageData openCageData, OpenWeatherData openWeatherData, DefaultLocation defaultLocation) { ConnectionStrings = cStrings; Intervals = intervals; OpenCageData = openCageData; OpenWeatherData = openWeatherData; DefaultLocation = defaultLocation; }
/// <summary> /// Extension method for extracting defaults and apikeys from iconfiguration instance /// </summary> /// <param name="config"></param> /// <returns></returns> public static ServiceAppSettings ExtractWeatherSettings(this IConfiguration config) { Dictionary <string, string> cStrings = config.GetSection("ConnectionStrings").Get <Dictionary <string, string> >(); Dictionary <string, double> intervals = config.GetSection("DefaultIntervals").Get <Dictionary <string, double> >(); OpenCageData openCageData = config.GetSection("OpenCageData").Get <OpenCageData>(); OpenWeatherData openWeatherData = config.GetSection("OpenWeatherData").Get <OpenWeatherData>(); DefaultLocation defaultLocation = config.GetSection("DefaultLocation").Get <DefaultLocation>(); return(new ServiceAppSettings(cStrings, intervals, openCageData, openWeatherData, defaultLocation)); }