public CsissorsContext(ILogger <CsissorsContext> log, IExecutor executor, IRepository repository, ITaskInstanceFactory taskInstanceFactory, TaskSet taskSet, IOptions <CsissorsOptions> options) { Tasks = taskSet ?? throw new ArgumentNullException(nameof(taskSet)); _log = log ?? throw new ArgumentNullException(nameof(log)); _executor = executor ?? throw new ArgumentNullException(nameof(executor)); _repository = repository ?? throw new ArgumentNullException(nameof(repository)); _taskInstanceFactory = taskInstanceFactory ?? throw new ArgumentNullException(nameof(taskInstanceFactory)); _configuration = options.Value; }
public async Task <IAppContext> BuildAsync(CancellationToken cancellationToken) { var serviceProvider = Services.BuildServiceProvider(); var taskSet = TaskSet.BuildTasks(serviceProvider, _staticTaskBuilders, _dynamicTaskBuilders); var repositoryFactory = serviceProvider.GetRequiredService <IRepositoryFactory>(); var repository = await repositoryFactory.CreateRepositoryAsync(cancellationToken); return(ActivatorUtilities.CreateInstance <CsissorsContext>(serviceProvider, taskSet, repository)); }