Esempio n. 1
0
 private static void SetFlowResponseProperty(TFlowResponse flowResponse,
                                             FlowObjectProperty flowResponseProperty, FlowValues flowValues)
 {
     if (flowValues.TryGetValue(flowResponseProperty.PropertyInfo.Name, out var flowValue))
     {
         flowResponseProperty.PropertyInfo.SetValue(flowResponse, flowValue);
     }
 }
Esempio n. 2
0
        internal bool TryGetRequestValue(FlowValues flowValues, object request, out object requestValue)
        {
            requestValue = (object)null;

            var flowValueNames = this.FlowValueSelector.ResolveNames(request, flowValues);

            if (this.Property.IsDictionaryBinding)
            {
                var flowValueDictionary = (IFlowValueDictionary)Activator.CreateInstance(this.Property.DictionaryType);

                foreach (var flowValueName in flowValueNames)
                {
                    if (!flowValues.TryGetValue(flowValueName, out var flowValue))
                    {
                        continue;
                    }

                    var value = GetMappedValue(flowValue);
                    var name  = GetMappedName(flowValueName, request);

                    flowValueDictionary.SetValue(name, value);
                }

                requestValue = flowValueDictionary;
            }
            else
            {
                var flowValueName = flowValueNames.First();

                if (flowValues.TryGetValue(flowValueName, out var flowValue))
                {
                    requestValue = GetMappedValue(flowValue);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }