示例#1
0
        /// <summary>
        /// Create a URI for the given queryDescriptor given the base service URI.
        /// </summary>
        /// <param name="baseUri">The base service URI.</param>
        /// <param name="queryDescriptor">The query descriptor to create the result URI from.</param>
        /// <returns>An absolute URI that base on the baseUri and represent the queryDescriptor.</returns>
        public static Uri CreateUri(Uri baseUri, QueryDescriptorQueryToken queryDescriptor)
        {
            ExceptionUtils.CheckArgumentNotNull(baseUri, "baseUri");
            ExceptionUtils.CheckArgumentNotNull(queryDescriptor, "queryDescriptor");

            ODataUriBuilder odataUriBuilder = new ODataUriBuilder(queryDescriptor);
            string uriPart = odataUriBuilder.Build();
            if (uriPart.StartsWith(ExpressionConstants.SymbolQueryStart, StringComparison.Ordinal))
            {
                UriBuilder uriBuilder = new UriBuilder(baseUri);
                uriBuilder.Query = uriPart;
                return uriBuilder.Uri;
            }

            return new Uri(baseUri, new Uri(uriPart, UriKind.RelativeOrAbsolute));
        }
示例#2
0
        /// <summary>
        /// Create a URI for the given queryDescriptor given the base service URI.
        /// </summary>
        /// <param name="baseUri">The base service URI.</param>
        /// <param name="queryDescriptor">The query descriptor to create the result URI from.</param>
        /// <returns>An absolute URI that base on the baseUri and represent the queryDescriptor.</returns>
        public static Uri CreateUri(Uri baseUri, QueryDescriptorQueryToken queryDescriptor)
        {
            ExceptionUtils.CheckArgumentNotNull(baseUri, "baseUri");
            ExceptionUtils.CheckArgumentNotNull(queryDescriptor, "queryDescriptor");

            ODataUriBuilder odataUriBuilder = new ODataUriBuilder(queryDescriptor);
            string          uriPart         = odataUriBuilder.Build();

            if (uriPart.StartsWith(ExpressionConstants.SymbolQueryStart, StringComparison.Ordinal))
            {
                UriBuilder uriBuilder = new UriBuilder(baseUri);
                uriBuilder.Query = uriPart;
                return(uriBuilder.Uri);
            }

            return(new Uri(baseUri, new Uri(uriPart, UriKind.RelativeOrAbsolute)));
        }
 /// <summary>
 /// Create a new BinaryOperatorQueryToken for the given Uri builder to write BinaryOperatorQueryToken.
 /// </summary>
 /// <param name="builder">The parent builder of this builder.</param>
 public BinaryOperatorUriBuilder(ODataUriBuilder builder)
 {
     this.builder = builder;
 }
 /// <summary>
 /// Create a new BinaryOperatorQueryToken for the given Uri builder to write BinaryOperatorQueryToken.
 /// </summary>
 /// <param name="builder">The parent builder of this builder.</param>
 public BinaryOperatorUriBuilder(ODataUriBuilder builder)
 {
     this.builder = builder;
 }