static async Task Main(string[] args) { Console.WriteLine(AppConstant.ApplicationName); var host = Host .CreateDefaultBuilder(args) .ConfigureServices((_, services) => { services .AddSingleton(typeof(ILogger), typeof(CustomLogger)) .AddSingleton(typeof(IGameDefinitionAccess), typeof(GameDefinitionAccess)) .AddSingleton(typeof(IGameSessionAccess), typeof(GameSessionAccess)) .AddSingleton(typeof(IPlayerAccess), typeof(PlayerAccess)) .AddSingleton(typeof(ITileAccess), typeof(TileAccess)) .AddSingleton(typeof(IGameBoardEngine), typeof(GameBoardEngine)) .AddSingleton(typeof(IGamePlayEngine), typeof(GamePlayEngine)) .AddSingleton(typeof(IValidationEngine), typeof(ValidationEngine)) .AddSingleton(typeof(IGameManager), typeof(GameManager)); }) .Build(); var gameManager = host.Services.GetService <IGameManager>(); var client = new ConsoleClient(gameManager); await client.Run(); }
static async Task Main(string[] args) { var container = new UnityContainer(); container.RegisterType <IGameDefinitionAccess, GameDefinitionAccess>(); container.RegisterType <IGameSessionAccess, GameSessionAccess>(); container.RegisterType <IPlayerAccess, PlayerAccess>(); container.RegisterType <ITileAccess, TileAccess>(); container.RegisterType <IGameBoardEngine, GameBoardEngine>(); container.RegisterType <IGamePlayEngine, GamePlayEngine>(); container.RegisterType <IValidationEngine, ValidationEngine>(); container.RegisterType <IGameManager, GameManager>(); var gameManager = container.Resolve <IGameManager>(); var client = new ConsoleClient(gameManager); await client.Run(); }