Example #1
0
        public async Task Run(IConfigurationRoot configurationRoot)
        {
            // Let the build config happen in main and get a reference to it.
            _configurationRoot = configurationRoot;

            string urlPeopleJSON = ConfigBuildHelper.GetURLByEndpoint(_configurationRoot, "people");
            // _logger.LogInformation($"{urlPeopleJSON }");

            // Get Data via service
            var listOwnerGrouping = await _ownerService.GetAll();

            // Console write data with formatter
            // _consoleFormatterOwner.DisplayAllByGender(listOwnerGrouping);
            _consoleFormatterOwner.DisplayAllByGenderPets(listOwnerGrouping.ToList());

            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            // create service collection - IInterface, etc.
            IServiceCollection serviceCollection = new ServiceCollection();

            ServiceCollectionHelper.ConfigureAddServices(serviceCollection);
            ServiceCollectionHelper.ConfigureAddLogging(serviceCollection);

            // create service provider
            _serviceProvider = serviceCollection.BuildServiceProvider();

            // create build
            _configurationRoot = ConfigBuildHelper.ConfigBuild();

            // Need to call an async method specifically as HTTP client is async
            MainAsync(args, _serviceProvider).GetAwaiter().GetResult();

            Console.ReadLine();
        }