/// <summary> /// Initializes a new instance of the <see cref="TaskRunner{TRunnable}"/> class. /// </summary> /// <param name="loggerFactory">Фабрика для создания логгера</param> /// <param name="options">TaskOptions</param> /// <param name="serviceScopeFactory">Фабрика для создания Scope (при запуске задачи)</param> public TaskRunner(ILoggerFactory loggerFactory, TaskOptions <TRunnable> options, IServiceScopeFactory serviceScopeFactory) { if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (serviceScopeFactory == null) { throw new ArgumentNullException(nameof(serviceScopeFactory)); } this.logger = loggerFactory.CreateLogger($"{this.GetType().Namespace}.{nameof(TaskRunner<TRunnable>)}<{typeof(TRunnable).FullName}>"); Options = options; ServiceScopeFactory = serviceScopeFactory; RunStatus = new TaskRunStatus(); }
/// <summary> /// Initializes a new instance of the <see cref="TaskRunner{TRunnable}"/> class. /// </summary> /// <param name="loggerFactory">Фабрика для создания логгера</param> /// <param name="serviceScopeFactory">Фабрика для создания Scope (при запуске задачи)</param> public TaskRunner(ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory) { this.logger = loggerFactory.CreateLogger($"{this.GetType().Namespace}.{nameof(TaskRunner<TRunnable>)}<{typeof(TRunnable).FullName}>"); ServiceScopeFactory = serviceScopeFactory; RunStatus = new TaskRunStatus(); }