/// <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"); OperationSegment otherOperation = other as OperationSegment; return(otherOperation != null && otherOperation.Operations.SequenceEqual(this.Operations) && otherOperation.EntitySet == this.entitySet); }
/// <summary> /// Translate a OperationSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Translated WebApi path segment.</returns> public override IEnumerable <ODataPathSegment> Translate(Semantic.OperationSegment segment) { IEdmAction action = segment.Operations.Single() as IEdmAction; if (action != null) { yield return(new BoundActionPathSegment(action, _model)); } else { // Translate the nodes in ODL path to string literals as parameter of BoundFunctionPathSegment. Dictionary <string, string> parameterValues = segment.Parameters.ToDictionary( parameterValue => parameterValue.Name, parameterValue => TranslateNode(parameterValue.Value)); IEdmFunction function = (IEdmFunction)segment.Operations.Single(); yield return(new BoundFunctionPathSegment(function, _model, parameterValues)); } }
/// <summary> /// Determine the NavigationSource of an OperationSegment /// </summary> /// <param name="segment">The OperationSegment to look in.</param> /// <returns>The IEdmNavigationSource of this OperationSegment</returns> /// <exception cref="System.ArgumentNullException">Throws if the input segment is null.</exception> public override IEdmNavigationSource Translate(OperationSegment segment) { ExceptionUtils.CheckArgumentNotNull(segment, "segment"); return(segment.EntitySet); }