// See https://aka.ms/new-console-template for more information using Autofac; using CommandLine; using GameData; using GameData.Repository; using GameHandler; using GameHandler.DeathGame; using GameHandler.Extensions; using GameModel; using GameModel.Contract; using GameModel.DeathGame; using GameModel.Settings; using KoogleCli.Model; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Spectre.Console; using Spectre.Console.Json; using static System.Runtime.InteropServices.JavaScript.JSType; const string RootLifetimeTag = "MyIsolatedRoot"; AnsiConsole.MarkupLine("Welcome to [green]koogle[/]"); var container = Register(); var serviceCollection = new ServiceCollection(); //serviceCollection.AddLogging(); var scope = container.BeginLifetimeScope(RootLifetimeTag, b => { //b.Populate(serviceCollection, RootLifetimeTag); }); Autofac.IContainer Register() { var configurationBuilder = new ConfigurationBuilder() .SetBasePath(AppDomain.CurrentDomain.BaseDirectory) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) //.AddXmlFile("appsettings.xml", optional: true, reloadOnChange: true) //.AddEnvironmentVariables() //.AddCommandLine(args); ; // Add your custom configuration provider here if needed // .Add(new CustomConfigurationSource()); IConfiguration configuration = configurationBuilder.Build(); var someSettings = configuration.GetSection(typeof(AppSettings).Name).Get(); var builder = new ContainerBuilder(); builder.RegisterInstance(someSettings); builder.RegisterType().As(); return builder.Build(); } var test = container.Resolve(); Console.WriteLine( test.Test); Console.ReadLine(); ShowMainMenu(); void ShowMainMenu() { do { var option = AnsiConsole.Prompt( new SelectionPrompt