private void ExecutePlugin(Type type) { try { log.Debug($"Инстанцирование типа — {type.FullName}"); log.Debug($"Рабочий каталог домена приложения: {AppDomain.CurrentDomain.BaseDirectory}"); IPipelinePlugin plugin = (IPipelinePlugin)Activator.CreateInstance(type, _pipelineExecutionContext); log.Debug($"Инстанцирование типа — {type.FullName} завершено!"); plugin.BeforeExecution(); plugin.Execute(); plugin.AfterExecution(); } catch (Exception ex) { log.Fatal("Во время выполнения работы плагина произошла ошибка", ex); ProcessingError pe = new ProcessingError { MessageId = _messageId, StackTrace = ex.StackTrace, Error = ex.Message }; _dbContext.ProcessingErrors.Add(pe); _dbContext.SaveChanges(); throw; } }
public PipelinePluginInstantiation(IPipelinePlugin instance) { Instance = instance; }