| 123456789101112131415161718192021222324252627282930313233343536 |
- using Quadarax.Application.QLiberace.Processor.Entities;
- using Quadarax.Application.QLiberace.Common.Executor;
- using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
- using Quadarax.Foundation.Core.Logging;
- using Quadarax.Foundation.Core.Reflection.Extensions;
- namespace Quadarax.Application.QLiberace.Processor.Executor
- {
- internal class ExecutorInternal
- {
- private ProcessingQueue _item;
- private IList<ParameterExecutorValue> _data;
- public ExecutorInternal(ProcessingQueue item, IEnumerable<ParameterExecutorValue> data)
- {
- _item = item ?? throw new ArgumentNullException(nameof(item));
- _data = new List<ParameterExecutorValue>();
- }
- public ResultBoolDto Execute(TimeSpan timeout, IQLogger? logger = null)
- {
- try
- {
- var provider = (IParametricExecutorProvider) ActivatorExt.CreateInstance(_item.Provider,true, timeout, logger);
- if (provider == null)
- throw new InvalidOperationException($"Cannot create executor provider from '{_item.Provider}'.");
- var result = provider.Execute(_data);
- return new ResultBoolDto(result);
- }
- catch (Exception e)
- {
- return new ResultBoolDto(e);
- }
- }
- }
- }
|