예제 #1
0
        public FlowActivityDefinition <TReq, TRes> BindOutputs <TVal>(Expression <Func <TRes, FlowValueDictionary <TVal> > > propertyExpression,
                                                                      FlowValueSelector flowValueSelector, Func <TVal, object> mapValue = null)
        {
            var propertyInfo = ReflectionUtils.GetProperty(propertyExpression);

            var boundOutputProperty = typeof(TRes).GetFlowObjectType()[propertyInfo.Name];

            var binding = new FlowValueOutputBinding(boundOutputProperty)
            {
                FlowValueSelector = flowValueSelector
            };

            if (mapValue != null)
            {
                binding.MapValue = fv => mapValue((TVal)fv);
            }

            Outputs.Add(binding);

            return(this);
        }
예제 #2
0
        public FlowInitializer <TReq> BindValue <TVal>(Expression <Func <TReq, TVal> > propertyExpression, string flowValueName, Func <TVal, object> mapValue = null)
        {
            var propertyInfo = ReflectionUtils.GetProperty(propertyExpression);

            var boundOutputProperty = typeof(TReq).GetFlowObjectType()[propertyInfo.Name];

            var binding =
                new FlowValueOutputBinding(boundOutputProperty)
            {
                MapName = (n, r) => flowValueName
            };

            if (mapValue != null)
            {
                binding.MapValue = fv => mapValue((TVal)fv);
            }

            Outputs.Add(binding);

            return(this);
        }