/// <summary>
        /// Find out whether action matches with the ODataUri select function segment
        /// </summary>
        /// <param name="action">The action</param>
        /// <param name="selectSegment">The segment</param>
        /// <returns>Whether action matches with the function segment</returns>
        private bool FuctionMatchWithSelectFunctionSegment(Function action, ODataUriSegment selectSegment)
        {
            FunctionSegment selectFunctionSegment = selectSegment as FunctionSegment;

            if (selectFunctionSegment != null && selectFunctionSegment.Function == action)
            {
                return(true);
            }

            // Sometimes the $select segment is an UnrecognizedSegment
            UnrecognizedSegment otherTypeOfSelectSegment = selectSegment as UnrecognizedSegment;

            if (otherTypeOfSelectSegment != null && selectFunctionSegment == null)
            {
                string actionName = action.Name;

                // Determine the if selction segment was <Action Name> or <EntityContainer>.<Action Name>
                if (otherTypeOfSelectSegment.Value.Contains('.'))
                {
                    actionName = string.Concat(action.Model.GetDefaultEntityContainer().Name, ".", actionName);
                }

                if (otherTypeOfSelectSegment.Value.Equals(actionName, System.StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Find out whehter the given segment is select-all-function-segment (ContainerName.*)
        /// </summary>
        /// <param name="selectSegment">The segment</param>
        /// <returns>Whether segment is select-all-function-segment</returns>
        private bool IsSelectAllFunctionSegment(ODataUriSegment selectSegment)
        {
            UnrecognizedSegment selectAllFunctionSegment = selectSegment as UnrecognizedSegment;

            if (selectAllFunctionSegment != null && selectAllFunctionSegment.Value == this.model.GetDefaultEntityContainer().Name + ".*")
            {
                return(true);
            }

            return(false);
        }
Beispiel #3
0
 /// <summary>
 /// Converts the given segment into a string
 /// </summary>
 /// <param name="segment">The segment to convert</param>
 /// <returns>The converted segment string</returns>
 public string ConvertToString(UnrecognizedSegment segment)
 {
     return(segment.Value);
 }