// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Task.Run(async() => { if (await dbOperator.CheckExists()) { await dbOperator.CreateCollection(); await dbOperator.UpdateCollection(); } }); services.AddSingleton <IDBOperator>(dbOperator); services.AddSingleton <IPreprocessable>(preprocessor); services.AddControllers(); }