Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });
            services.AddControllers();
            services.AddScoped <ICustomService, BuzzWordGenerator>();
            services.AddScoped <ICustomService, RandomDogGenerator>();
            services.AddScoped <ICustomService, CopyCatRepeater>();
            services.AddScoped <ICustomService, OpenDotaRetriever>();
            services.AddScoped <RestExecutioner>();
            services.AddScoped <IMessageProcessor, IncomingMessageProcessor>();
            services.AddHttpClient <TelegramService>();
            services.AddHttpClient <SlackService>();
            services.AddScoped <WhatsAppService>();

            // Feature Provider Library initial setup
            // services.AddFeatureProvider(Configuration);

            //
            // services.AddOptions();
            // services.Configure<ServicesSettings>(options => Configuration.GetSection("ServicesSettings").Bind(options));

            var servicesSettings = Configuration.GetSection("ServicesSettings").Get <ServicesSettings>();//Configuration.GetSection("Services").Get<Service[]>();

            ServiceMapper.Initialize(servicesSettings);
            // services.AddSingleton<ServicesSettings>(servicesSettings);
        }