/// <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");
            AnnotationSegment otherTerm = other as AnnotationSegment;

            return(otherTerm != null && otherTerm.term == this.term);
        }
Exemple #2
0
        /// <summary>
        /// Tries to bind a given token as a declared annotation term.
        /// </summary>
        /// <param name="tokenIn">Token to bind.</param>
        /// <param name="model">The model to search for this term</param>
        /// <param name="resolver">Resolver for uri parser.</param>
        /// <param name="segment">Bound segment if the token was bound to a declared term successfully, or null.</param>
        /// <returns>True if the token was bound successfully, or false otherwise.</returns>
        private static bool TryBindAsDeclaredTerm(PathSegmentToken tokenIn, IEdmModel model, ODataUriResolver resolver, out ODataPathSegment segment)
        {
            if (!UriParserHelper.IsAnnotation(tokenIn.Identifier))
            {
                segment = null;
                return(false);
            }

            IEdmTerm term = resolver.ResolveTerm(model, tokenIn.Identifier.Remove(0, 1));

            if (term == null)
            {
                segment = null;
                return(false);
            }

            segment = new AnnotationSegment(term);
            return(true);
        }
 /// <summary>
 /// Translate an AnnotationSegment
 /// </summary>
 /// <param name="segment">the segment to Translate</param>
 /// <returns>Defined by the implementer.</returns>
 public override string Translate(AnnotationSegment segment)
 {
     Debug.Assert(segment != null, "segment != null");
     return("/" + segment.Term.FullName());
 }
 /// <summary>
 /// Translate an AnnotationSegment
 /// </summary>
 /// <param name="segment">the segment to Translate</param>
 /// <returns>UserDefinedValue</returns>
 /// <exception cref="System.ArgumentNullException">Throws if the input segment is null.</exception>
 public override bool Translate(AnnotationSegment segment)
 {
     ExceptionUtils.CheckArgumentNotNull(segment, "segment");
     return(false);
 }
 /// <summary>
 /// Handle an AnnotationSegment
 /// </summary>
 /// <param name="segment">the segment to Handle</param>
 public override void Handle(AnnotationSegment segment)
 {
     CommonHandler(segment);
 }
 /// <summary>
 /// Handle an AnnotationSegment
 /// </summary>
 /// <param name="segment">the segment to Handle</param>
 public virtual void Handle(AnnotationSegment segment)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 /// <summary>
 /// Translate an AnnotationSegment
 /// </summary>
 /// <param name="segment">the segment to Translate</param>
 /// <returns>Defined by the implementer.</returns>
 public virtual T Translate(AnnotationSegment segment)
 {
     throw new NotImplementedException();
 }