// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddOptions(); ApiProfiles profiles = new ApiProfiles(); var profileConfigs = Configuration.GetSection("ApiProfiles").GetChildren(); //var sadsa = new ApiProfile(); //var p1 = Configuration.GetSection("ApiProfiles").GetSection("TaxJar.Production"); profileConfigs.ToList().ForEach(p => { profiles.Add(p.Key, p.Get <ApiProfile>()); }); Configuration.GetSection("ApiProfiles").Bind(profiles); services.AddSingleton(profiles); }
public TaxService(ApiProfiles profiles) { _profiles = profiles; }