コード例 #1
0
ファイル: FlowHandler.cs プロジェクト: andybalham/FlowR
 private static void CheckMandatoryFlowObjectProperty(object flowObject,
                                                      FlowObjectProperty flowObjectProperty, ICollection <string> missingPropertyNames)
 {
     if (flowObjectProperty.IsNotNullValue && (flowObjectProperty.PropertyInfo.GetValue(flowObject) == null))
     {
         missingPropertyNames.Add(flowObjectProperty.PropertyInfo.Name);
     }
 }
コード例 #2
0
ファイル: FlowHandler.cs プロジェクト: andybalham/FlowR
 private static void SetFlowResponseProperty(TFlowResponse flowResponse,
                                             FlowObjectProperty flowResponseProperty, FlowValues flowValues)
 {
     if (flowValues.TryGetValue(flowResponseProperty.PropertyInfo.Name, out var flowValue))
     {
         flowResponseProperty.PropertyInfo.SetValue(flowResponse, flowValue);
     }
 }
コード例 #3
0
        public FlowValueOutputBinding GetOutputBinding(FlowObjectProperty flowObjectProperty)
        {
            var binding =
                this.Outputs.Find(i => i.Property.Name == flowObjectProperty.Name)
                ?? new FlowValueOutputBinding(flowObjectProperty);

            return(binding);
        }
コード例 #4
0
ファイル: FlowObjectType.cs プロジェクト: andybalham/FlowR
        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();
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: FlowValueBinding.cs プロジェクト: andybalham/FlowR
 protected FlowValueBinding(FlowObjectProperty property)
 {
     this.Property = property ?? throw new ArgumentNullException(nameof(property));
 }
コード例 #7
0
ファイル: FlowValueBinding.cs プロジェクト: andybalham/FlowR
 public FlowValueInputBinding(FlowObjectProperty property) : base(property)
 {
 }