public Program(IApplicationEnvironment env) { var configuration = new ConfigurationBuilder() .SetBasePath(env.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables() .Build(); _provider = new ServiceCollection() .AddLogging() .AddOptions() .Configure<ProjectOptions>(configuration) .Configure<CompileWorkerOptions>(configuration) .Configure<OutputAnalazerOptions>(configuration) .AddProceesProviderServices() .AddTransient<ConsoleWriter>() .AddTransient<OutputAnalazer>() .AddTransient<CompileWorker>() .AddTransient<ProjectProcessor>() .BuildServiceProvider(); _provider.GetService<ILoggerFactory>().AddConsole(LogLevel.Information); _consoleWriter = _provider.GetService<ConsoleWriter>(); var optionsAccessor = _provider.GetService<IOptions<ProjectOptions>>().Value; _nextProjectId = optionsAccessor.NextProjectInx; _continueWithProjectProcessing = optionsAccessor.ContinueWithProjectProcessing; }
public Program() { _consoleWriter = new ConsoleWriter(); IServiceProvider serviceProvider = new ServiceCollection() .AddProceesProviderServices() .BuildServiceProvider(); _executorProvider=serviceProvider.GetService<IProcessExecutorProvider>(); }
public CompileWorker(IOptions<CompileWorkerOptions> optionsAccessor, ConsoleWriter consoleWriter, IProcessExecutorProvider provider) { _msBuild = optionsAccessor.Value.MsBuild; _outFile = optionsAccessor.Value.OutFile; _compileDirectory = optionsAccessor.Value.CompileDirectory; _consoleWriter = consoleWriter; _executorProvider = provider; }
public OutputAnalazer(IOptions<OutputAnalazerOptions> optionsAccessor, ConsoleWriter consoleWriter){ _outputfile = optionsAccessor.Value.OutFile; _consoleWriter = consoleWriter; }
public Program() { _consoleWriter = new ConsoleWriter(); }
public ProjectProcessor(ConsoleWriter consoleWriter, OutputAnalazer outputAnalazer) { _consoleWriter = consoleWriter; _outputAnalayzer = outputAnalazer; }