예제 #1
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc()
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
            });

            services.AddSwaggerGen(options =>
            {
                options.DefaultLykkeConfiguration("v1", "LykkeService API");
            });

            var builder     = new ContainerBuilder();
            var appSettings = Environment.IsDevelopment()
                ? Configuration.Get <AppSettings>()
                : HttpSettingsLoader.Load <AppSettings>(Configuration.GetValue <string>("SettingsUrl"));
            var log = CreateLogWithSlack(services, appSettings);

            builder.RegisterModule(new ServiceModule(appSettings.LykkeServiceService, log));
            builder.Populate(services);
            ApplicationContainer = builder.Build();

            return(new AutofacServiceProvider(ApplicationContainer));
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc()
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
            });

            services.AddSwaggerGen(options =>
            {
                options.DefaultLykkeConfiguration("v1", "Lykke Market Profile");
            });

            var settings    = HttpSettingsLoader.Load <ApplicationSettings>();
            var log         = CreateLog(services, settings);
            var appSettings = settings.MarketProfileService;
            var builder     = new ContainerBuilder();

            builder.RegisterModule(new ApiModule(appSettings, log));
            builder.Populate(services);

            ApplicationContainer = builder.Build();

            return(new AutofacServiceProvider(ApplicationContainer));
        }
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc()
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.ContractResolver =
                    new Newtonsoft.Json.Serialization.DefaultContractResolver();
            });

            services.AddSwaggerGen(options =>
            {
                options.DefaultLykkeConfiguration("v1", "TransactionHandler API");
            });

            var builder     = new ContainerBuilder();
            var appSettings = Environment.IsDevelopment()
                ? Configuration.Get <AppSettings>()
                : HttpSettingsLoader.Load <AppSettings>(Configuration.GetValue <string>("SettingsUrl"));
            var log = CreateLogWithSlack(services, appSettings);

            builder.RegisterModule(new JobModule(appSettings, log));

            if (string.IsNullOrWhiteSpace(appSettings.TransactionHandlerJob.Db.BitCoinQueueConnectionString))
            {
                builder.AddTriggers();
            }
            else
            {
                builder.AddTriggers(pool =>
                {
                    pool.AddDefaultConnection(appSettings.TransactionHandlerJob.Db.BitCoinQueueConnectionString);
                });
            }

            builder.Populate(services);

            ApplicationContainer = builder.Build();

            StartSubscribers();

            return(new AutofacServiceProvider(ApplicationContainer));
        }