/// <summary>
        /// Check if this segment is equal to another segment.
        /// </summary>
        /// <param name="other">the other segment to check.</param>
        /// <returns>true if the other segment is equal.</returns>
        /// <exception cref="System.ArgumentNullException">Throws if the input other is null.</exception>
        internal override bool Equals(ODataPathSegment other)
        {
            ExceptionUtils.CheckArgumentNotNull(other, "other");
            OperationImportSegment otherOperation = other as OperationImportSegment;

            return(otherOperation != null &&
                   otherOperation.OperationImports.SequenceEqual(this.OperationImports) &&
                   otherOperation.EntitySet == this.entitySet);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Translate a OperationImportSegment
        /// </summary>
        /// <param name="segment">the segment to Translate</param>
        /// <returns>Translated WebApi path segment.</returns>
        public override IEnumerable <ODataPathSegment> Translate(Semantic.OperationImportSegment segment)
        {
            IEdmActionImport actionImport = segment.OperationImports.Single() as IEdmActionImport;

            if (actionImport != null)
            {
                yield return(new UnboundActionPathSegment(actionImport));
            }
            else
            {
                // Translate the nodes in ODL path to string literals as parameter of UnboundFunctionPathSegment.
                Dictionary <string, string> parameterValues = segment.Parameters.ToDictionary(
                    parameterValue => parameterValue.Name,
                    parameterValue => TranslateNode(parameterValue.Value));

                yield return(new UnboundFunctionPathSegment(
                                 (IEdmFunctionImport)segment.OperationImports.Single(),
                                 _model,
                                 parameterValues));
            }
        }
 /// <summary>
 /// Translate a OperationImportSegment
 /// </summary>
 /// <param name="segment">the segment to Translate</param>
 /// <returns>Defined by the implementer.</returns>
 public override IEdmNavigationSource Translate(OperationImportSegment segment)
 {
     ExceptionUtils.CheckArgumentNotNull(segment, "segment");
     return(segment.EntitySet);
 }