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)
        {
            var geoRestSvc         = new RestRequestor <GeoResponse>();
            var weatherRestSvc     = new RestRequestor <ForecastResponse>();
            var parser             = new GeoQueryParser();
            var geoDispatchSvc     = new GeocodioQueryDispatchService(geoRestSvc);
            var weatherDispatchSvc = new DarkskyQueryDispatchService(weatherRestSvc);

            services.AddMvc();

            services.AddSingleton <IGeoQueryService>(new GeocodioQueryService(parser, geoDispatchSvc));
            services.AddSingleton <IWeatherQueryService>(new DarkskyQueryService(weatherDispatchSvc));
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var geoRestSvc         = new RestRequestor <GeoResponse>();
            var weatherRestSvc     = new RestRequestor <ForecastResponse>();
            var parser             = new GeoQueryParser();
            var geoDispatchSvc     = new GeocodioQueryDispatchService(geoRestSvc);
            var weatherDispatchSvc = new DarkskyQueryDispatchService(weatherRestSvc);

            // Add framework services.
            services.AddMvc();

            // Add custom services
            services.AddEnyimMemcached(options => Configuration.GetSection("enyimMemcached").Bind(options)); // this was a dumb way to do it...
            var sp = services.BuildServiceProvider();
            var memcachedService = sp.GetService <IMemcachedClient>();

            services.AddSingleton <IGeoQueryService>(new GeocodioQueryService(parser, geoDispatchSvc, memcachedService));
            services.AddSingleton <IWeatherQueryService>(new DarkskyQueryService(weatherDispatchSvc, memcachedService));
        }
Esempio n. 3
0
 public DarkskyQueryDispatchService(RestRequestor <ForecastResponse> restService)
 {
     _restService = restService;
 }
 public GeocodioQueryDispatchService(RestRequestor <GeoResponse> restService)
 {
     _restService = restService;
 }