Пример #1
0
        /// <inheritdoc />
        public override bool TryMatch(ODataPathSegment pathSegment, IDictionary <string, object> values)
        {
            if (pathSegment.SegmentKind == ODataSegmentKinds.UnboundFunction)
            {
                UnboundFunctionPathSegment functionSegment = (UnboundFunctionPathSegment)pathSegment;
                if (_functionName == functionSegment.FunctionName)
                {
                    var enumNames = functionSegment.Function.Function.Parameters.Where(p => p.Type.IsEnum()).Select(p => p.Name);
                    if (KeyValuePathSegmentTemplate.TryMatch(ParameterMappings, functionSegment.Values, values,
                                                             enumNames))
                    {
                        foreach (KeyValuePair <string, string> nameAndValue in functionSegment.Values)
                        {
                            string name  = nameAndValue.Key;
                            object value = functionSegment.GetParameterValue(name);

                            //ProcedureRoutingConventionHelpers.AddFunctionParameters(functionSegment.Function.Function, name,
                            //    value, values, values, ParameterMappings);
                            throw new NotImplementedException("UnboundFunctionPathSegmentTemplate");
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UnboundFunctionPathSegmentTemplate"/> class.
        /// </summary>
        /// <param name="function">The function segment to be templatized.</param>
        public UnboundFunctionPathSegmentTemplate(UnboundFunctionPathSegment function)
        {
            if (function == null)
            {
                throw Error.ArgumentNull("function");
            }

            _functionName = function.FunctionName;
            ParameterMappings = KeyValuePathSegmentTemplate.BuildParameterMappings(function.Values, function.ToString());
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UnboundFunctionPathSegmentTemplate"/> class.
        /// </summary>
        /// <param name="function">The function segment to be templatized.</param>
        public UnboundFunctionPathSegmentTemplate(UnboundFunctionPathSegment function)
        {
            if (function == null)
            {
                throw Error.ArgumentNull("function");
            }

            _functionName     = function.FunctionName;
            ParameterMappings = KeyValuePathSegmentTemplate.BuildParameterMappings(function.Values, function.ToString());
        }
Пример #4
0
        /// <inheritdoc />
        public override bool TryMatch(ODataPathSegment pathSegment, IDictionary <string, object> values)
        {
            if (pathSegment.SegmentKind == ODataSegmentKinds.UnboundFunction)
            {
                UnboundFunctionPathSegment functionSegment = (UnboundFunctionPathSegment)pathSegment;
                return(functionSegment.Function == Function && functionSegment.FunctionName == FunctionName);
            }

            return(false);
        }