/// <summary> /// .net core pattern /// </summary> /// <param name="serviceCollection"></param> private static void ConfigureServices(ServiceCollection serviceCollection) { _configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetParent(AppContext.BaseDirectory).FullName) .AddJsonFile("appsettings.json", false) .Build(); serviceCollection.AddSingleton <IConfigurationRoot>(_configuration); serviceCollection.AddLogging(configure => configure.AddConsole().AddConfiguration(_configuration)); ILoggerFactory loggerFactory = new LoggerFactory(); _logger = loggerFactory.CreateLogger <Program>(); _nasaService = new NasaService(_configuration["NasaApiKey"]); serviceCollection.AddSingleton <INasaService>(_nasaService); _logger.LogInformation("[OK] Configure Services"); }
public NasaController(INasaService service) { _service = service; }
public void Setup() { _date = "June 2, 2018"; _nasaService = new NasaService(); }
public DataController(INasaService nasaService, IExcelConverterService excelConverter) { this.nasaService = nasaService; this.excelConverter = excelConverter; }
public NasaController(INasaService nasaService) { _nasaService = nasaService; }
public HomeController(INasaService nasaService, IExcelConverterService excelConverter, IMapper mapper) { this.nasaService = nasaService; this.excelConverter = excelConverter; this.mapper = mapper; }
public ApodController(INasaService nasaService) { this.nasaService = nasaService; }
public NasaController(INasaService nasaService, ILogger logger) { _logger = logger; _nasaService = nasaService; }