public ActionDependency(CollectionRuleActionOptions action, string resultName, int startIndex, int endIndex) { Action = action; ResultName = resultName; StartIndex = startIndex; EndIndex = endIndex; }
private void EnsureDependencies(CollectionRuleActionOptions options, int actionIndex) { foreach (PropertyInfo property in GetPropertiesFromSettings(options)) { string originalValue = (string)property.GetValue(options.Settings); string newValue = originalValue; if (string.IsNullOrEmpty(originalValue)) { continue; } int foundIndex = 0; int startIndex = 0; PropertyDependency propertyDependency = null; while ((foundIndex = newValue.IndexOf(ActionReferencePrefix, startIndex, StringComparison.OrdinalIgnoreCase)) >= 0) { int suffixIndex = newValue.IndexOf(SubstitutionSuffix, foundIndex, StringComparison.OrdinalIgnoreCase); if (suffixIndex == -1) { _ruleContext.Logger.InvalidActionReferenceToken(options.Name ?? actionIndex.ToString(), property.Name); break; } startIndex = suffixIndex; string actionAndResult = newValue[(foundIndex + ActionReferencePrefix.Length)..suffixIndex];
private void EnsureDependencies() { if (_dependencies == null) { _dependencies = new Dictionary <int, Dictionary <string, PropertyDependency> >(_ruleContext.Options.Actions.Count); for (int i = 0; i < _ruleContext.Options.Actions.Count; i++) { CollectionRuleActionOptions options = _ruleContext.Options.Actions[i]; EnsureDependencies(options, i); } } }
private void BindActionSettings(IConfigurationSection ruleSection, CollectionRuleOptions ruleOptions, int actionIndex) { CollectionRuleActionOptions actionOptions = ruleOptions.Actions[actionIndex]; if (null != actionOptions && _actionOperations.TryCreateOptions(actionOptions.Type, out object actionSettings)) { IConfigurationSection settingsSection = ruleSection.GetSection(ConfigurationPath.Combine( nameof(CollectionRuleOptions.Actions), actionIndex.ToString(CultureInfo.InvariantCulture), nameof(CollectionRuleActionOptions.Settings))); settingsSection.Bind(actionSettings); actionOptions.Settings = actionSettings; } }
private async Task WaitForCompletion(CollectionRuleContext context, Action startCallback, IDictionary <string, CollectionRuleActionResult> allResults, ICollectionRuleAction action, CollectionRuleActionOptions actionOption, CancellationToken cancellationToken) { //Before we wait for any other action to complete, we signal that execution has started. //This allows process resume to occur. startCallback?.Invoke(); CollectionRuleActionResult results = await action.WaitForCompletionAsync(cancellationToken); if (!string.IsNullOrEmpty(actionOption.Name)) { allResults.Add(actionOption.Name, results); } _logger.CollectionRuleActionCompleted(context.Name, actionOption.Type); }
public ActionCompletionEntry(ICollectionRuleAction action, CollectionRuleActionOptions options, int index) { Action = action ?? throw new ArgumentNullException(nameof(action)); Options = options ?? throw new ArgumentNullException(nameof(options)); Index = index; }