private static void ConfigureServices(IServiceCollection services) { // Build configuration IConfigurationRoot config = new ConfigurationBuilder() .AddJsonFile(path: "AppSettings.json", optional: false, reloadOnChange: false) .Build(); // Add logging Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(config) .CreateLogger(); services.AddSingleton <ILogger>(Log.Logger); // Add commands services.AddTransient <App, App>(); services.AddTransient <ConfigCommand, ConfigCommand>(); services.AddTransient <ServerListCommand, ServerListCommand>(); // Add services services.AddTransient <IRepository <Credentials>, FileRepository <Credentials> >(); services.AddTransient <IRepository <Server>, FileRepository <Server> >(); services.AddTransient <IServerApi, ServerApi>(); services.AddTransient <IServerPresenter, ServerPresenter>(); // Add configuration options services.AddOptions(); services.Configure <ServerApiOptions>(config.GetSection("Api").GetSection("ServerApi")); FileRepository.Configure(config.GetSection("Repository").GetSection("FileRepository").Get <FileRepositoryOptions>()); }