コード例 #1
0
ファイル: Startup.cs プロジェクト: ProbablyKTB/TaxServiceDemo
        // 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);
        }
コード例 #2
0
 public TaxService(ApiProfiles profiles)
 {
     _profiles = profiles;
 }