private static void CheckMandatoryFlowObjectProperty(object flowObject, FlowObjectProperty flowObjectProperty, ICollection <string> missingPropertyNames) { if (flowObjectProperty.IsNotNullValue && (flowObjectProperty.PropertyInfo.GetValue(flowObject) == null)) { missingPropertyNames.Add(flowObjectProperty.PropertyInfo.Name); } }
private static void SetFlowResponseProperty(TFlowResponse flowResponse, FlowObjectProperty flowResponseProperty, FlowValues flowValues) { if (flowValues.TryGetValue(flowResponseProperty.PropertyInfo.Name, out var flowValue)) { flowResponseProperty.PropertyInfo.SetValue(flowResponse, flowValue); } }
public FlowValueOutputBinding GetOutputBinding(FlowObjectProperty flowObjectProperty) { var binding = this.Outputs.Find(i => i.Property.Name == flowObjectProperty.Name) ?? new FlowValueOutputBinding(flowObjectProperty); return(binding); }
public FlowObjectType(Type type) { var publicInstanceProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); var internalPropertyNames = new[] { nameof(IFlowStepRequest.FlowContext), nameof(DecisionFlowStepBase.Branches), nameof(FlowResponse.CorrelationId), nameof(FlowResponse.RequestId), nameof(FlowResponse.FlowInstanceId), nameof(FlowResponse.Trace) }; var externalProperties = Array.FindAll(publicInstanceProperties, p => !Regex.IsMatch(p.Name, $"({string.Join("|", internalPropertyNames)})")); var flowObjectProperties = new List <FlowObjectProperty>(); foreach (var externalProperty in externalProperties) { var customAttributes = externalProperty.GetCustomAttributes(inherit: false); var flowObjectProperty = new FlowObjectProperty { Name = externalProperty.Name, PropertyInfo = externalProperty, IsNotNullValue = customAttributes.Any(a => a is NotNullValueAttribute), IsPrivate = customAttributes.Any(a => a is SensitiveValueAttribute), IsDictionaryBinding = externalProperty.PropertyType.IsGenericType && externalProperty.PropertyType.GetGenericTypeDefinition() == typeof(FlowValueDictionary <>), IsOverridableValue = customAttributes.Any(a => a is OverridableValueAttribute), Description = ((DescriptionAttribute)customAttributes.FirstOrDefault(a => a is DescriptionAttribute))?.Description, }; if (flowObjectProperty.IsDictionaryBinding) { flowObjectProperty.DictionaryValueType = externalProperty.PropertyType.GenericTypeArguments.First(); flowObjectProperty.DictionaryType = typeof(FlowValueDictionary <>).MakeGenericType(flowObjectProperty.DictionaryValueType); } flowObjectProperties.Add(flowObjectProperty); } Properties = flowObjectProperties.ToArray(); }
internal FlowValueInputBinding GetInputBinding(FlowObjectProperty flowObjectProperty) { var binding = this.Inputs.Find(i => i.Property.Name == flowObjectProperty.Name) ?? (flowObjectProperty.IsDictionaryBinding ? new FlowValueInputBinding(flowObjectProperty) { FlowValueSelector = new FlowValueTypeSelector(flowObjectProperty.DictionaryValueType) } : new FlowValueInputBinding(flowObjectProperty) { FlowValueSelector = new FlowValueSingleSelector(flowObjectProperty.Name) }); return(binding); }
protected FlowValueBinding(FlowObjectProperty property) { this.Property = property ?? throw new ArgumentNullException(nameof(property)); }
public FlowValueInputBinding(FlowObjectProperty property) : base(property) { }