// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 public IServiceProvider ConfigureServices(IServiceCollection services) //public void ConfigureServices(IServiceCollection services) { var settings = GeneralSettingsReader.ReadGeneralSettings <BaseSettings>(Configuration, "OffchainMonitorSettings"); services.AddMvc(o => { o.Filters.Add(new HandleAllExceptionsFilterFactory()); }); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { Title = "OffchainMonitor_Api", Version = "v1" }); options.DescribeAllEnumsAsStrings(); //Determine base path for the application. var basePath = PlatformServices.Default.Application.ApplicationBasePath; //Set the comments path for the swagger json and ui. var xmlPath = Path.Combine(basePath, "OffchainMonitorApi.xml"); options.IncludeXmlComments(xmlPath); }); var builder = new SqlliteBinder().Bind(settings); builder.Populate(services); builder.RegisterType <TimerTriggerBinding>(); builder.RegisterType <QueueTriggerBinding>(); builder.RegisterType <CommitmentBroadcastCheck>(); var container = builder.Build(); var triggerHost = new TriggerHost(new AutofacServiceProvider(container)); triggerHost.ProvideAssembly(GetType().GetTypeInfo().Assembly); triggerHost.StartAndBlock(); return(new AutofacServiceProvider(container)); }