// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. using System.Web.Http.Properties; namespace System.Web.Http.Query { /// /// Represents a single query operator to be applied to a query /// internal class ServiceQueryPart { /// /// Public constructor /// public ServiceQueryPart() { } /// /// Public constructor /// /// The query operator /// The query expression public ServiceQueryPart(string queryOperator, string expression) { if (queryOperator == null) { throw Error.ArgumentNull("queryOperator"); } if (expression == null) { throw Error.ArgumentNull("expression"); } if (!ServiceQuery.IsSupportedQueryOperator(queryOperator)) { throw Error.Argument("queryOperator", SRResources.InvalidQueryOperator, queryOperator); } QueryOperator = queryOperator; Expression = expression; } /// /// Gets or sets the query operator. Must be one of the supported operators : "where", "orderby", "skip", or "take". /// public string QueryOperator { get; set; } /// /// Gets or sets the query expression. /// public string Expression { get; set; } /// /// Returns a string representation of this /// /// The string representation of this public override string ToString() { return String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}", QueryOperator, Expression); } } }