コード例 #1
0
        /// <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");
        }
コード例 #2
0
 public NasaController(INasaService service)
 {
     _service = service;
 }
コード例 #3
0
 public void Setup()
 {
     _date        = "June 2, 2018";
     _nasaService = new NasaService();
 }
コード例 #4
0
 public DataController(INasaService nasaService, IExcelConverterService excelConverter)
 {
     this.nasaService    = nasaService;
     this.excelConverter = excelConverter;
 }
コード例 #5
0
 public NasaController(INasaService nasaService)
 {
     _nasaService = nasaService;
 }
コード例 #6
0
 public HomeController(INasaService nasaService, IExcelConverterService excelConverter, IMapper mapper)
 {
     this.nasaService    = nasaService;
     this.excelConverter = excelConverter;
     this.mapper         = mapper;
 }
コード例 #7
0
 public ApodController(INasaService nasaService)
 {
     this.nasaService = nasaService;
 }
コード例 #8
0
 public NasaController(INasaService nasaService, ILogger logger)
 {
     _logger      = logger;
     _nasaService = nasaService;
 }