Compartilhar via


QueryableAttribute Class

 

Note: This API is now obsolete.

Enables a controller action to support OData query parameters.

Namespace:   System.Web.Http
Assembly:  System.Web.Http.OData (in System.Web.Http.OData.dll)

Inheritance Hierarchy

System.Object
  System.Attribute
    System.Web.Http.Filters.FilterAttribute
      System.Web.Http.Filters.ActionFilterAttribute
        System.Web.Http.OData.EnableQueryAttribute
          System.Web.Http.QueryableAttribute

Syntax

[ObsoleteAttribute("This class is obsolete; use the EnableQueryAttribute class from the System.Web.Http.OData or System.Web.OData namespace.")]
public class QueryableAttribute : EnableQueryAttribute
[ObsoleteAttribute("This class is obsolete; use the EnableQueryAttribute class from the System.Web.Http.OData or System.Web.OData namespace.")]
public ref class QueryableAttribute : EnableQueryAttribute
[<ObsoleteAttribute("This class is obsolete; use the EnableQueryAttribute class from the System.Web.Http.OData or System.Web.OData namespace.")>]
type QueryableAttribute = 
    class
        inherit EnableQueryAttribute
    end
<ObsoleteAttribute("This class is obsolete; use the EnableQueryAttribute class from the System.Web.Http.OData or System.Web.OData namespace.")>
Public Class QueryableAttribute
    Inherits EnableQueryAttribute

Constructors

Name Description
System_CAPS_pubmethod QueryableAttribute()

Initializes a new instance of the QueryableAttribute class.

Properties

Name Description
System_CAPS_pubproperty AllowedArithmeticOperators

Gets or sets a value that represents a list of allowed arithmetic operators including 'add', 'sub', 'mul', 'div', 'mod'.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty AllowedFunctions

Gets or sets a value that represents a list of allowed functions used in the $filter query. The allowed functions include the following:

[list type="definition"] [item] [term]String related[/term] [description]substringof, endswith, startswith, length, indexof, substring, tolower, toupper, trim, concat e.g. ~/Customers?$filter=length(CompanyName) eq 19[/description] [/item] [item] [term]DateTime related[/term] [description]year, years, month, months, day, days, hour, hours, minute, minutes, second, seconds e.g. ~/Employees?$filter=year(BirthDate) eq 1971[/description] [/item] [item] [term]Math related[/term] [description]round, floor, ceiling[/description] [/item] [item] [term]Type related[/term] [description]isof, cast[/description] [/item] [item] [term]Collection related[/term] [description]any, all[/description] [/item] [/list](Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty AllowedLogicalOperators

Gets or sets a value that represents a list of allowed logical Operators such as 'eq', 'ne', 'gt', 'ge', 'lt', 'le', 'and', 'or', 'not'.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty AllowedOrderByProperties

Gets or sets a string with comma seperated list of property names. The queryable result can only be ordered by those properties defined in this list.

Note, by default this string is null, which means it can be ordered by any property.

For example, setting this value to null or empty string means that we allow ordering the queryable result by any properties. Setting this value to "Name" means we only allow queryable result to be ordered by Name property.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty AllowedQueryOptions

Gets or sets the query parameters that are allowed in queries. The default is all query options, including $filter, $skip, $top, $orderby, $expand, $select, $inlineCount, $format and $skiptoken.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty AllowMultiple

Gets a value that indicates whether multiple filters are allowed.(Inherited from FilterAttribute.)

System_CAPS_pubproperty EnableConstantParameterization

Gets or sets a value indicating whether constants should be parameterized. Parameterizing constants would result in better performance with Entity framework.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty EnsureStableOrdering

Gets or sets a value indicating whether query composition should alter the original query when necessary to ensure a stable sort order.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty HandleNullPropagation

Gets or sets a value indicating how null propagation should be handled during query composition.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxAnyAllExpressionDepth

Gets or sets the maximum depth of the Any or All elements nested inside the query. This limit helps prevent Denial of Service attacks. The default value is 1.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxExpansionDepth

Gets or sets the max expansion depth for the $expand query option. To disable the maximum expansion depth check, set this property to 0.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxNodeCount

Gets or sets the maximum number of nodes inside the $filter syntax tree. The default value is 100.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxOrderByNodeCount

Gets or sets the maximum number of expressions that can be present in the $orderby.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxSkip

Gets or sets the max value of $skip that a client can request.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty MaxTop

Gets or sets the max value of $top that a client can request.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty PageSize

Gets or sets the maximum number of query results to send back to clients.(Inherited from EnableQueryAttribute.)

System_CAPS_pubproperty TypeId

(Inherited from Attribute.)

Methods

Name Description
System_CAPS_pubmethod ApplyQuery(IQueryable, ODataQueryOptions)

Applies the query to the given IQueryable based on incoming query from uri and query settings. By default, the implementation supports $top, $skip, $orderby and $filter. Override this method to perform additional query composition of the query.(Inherited from EnableQueryAttribute.)

System_CAPS_pubmethod ApplyQuery(Object, ODataQueryOptions)

Applies the query to the given entity based on incoming query from uri and query settings.(Inherited from EnableQueryAttribute.)

System_CAPS_pubmethod Equals(Object)

(Inherited from Attribute.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Attribute.)

System_CAPS_pubmethod GetModel(Type, HttpRequestMessage, HttpActionDescriptor)

Gets the EDM model for the given type and request. Override this method to customize the EDM model used for querying.(Inherited from EnableQueryAttribute.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod IsDefaultAttribute()

(Inherited from Attribute.)

System_CAPS_pubmethod Match(Object)

(Inherited from Attribute.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod OnActionExecuted(HttpActionExecutedContext)

Performs the query composition after action is executed. It first tries to retrieve the IQueryable from the returning response message. It then validates the query from uri based on the validation settings on EnableQueryAttribute. It finally applies the query appropriately, and reset it back on the response message.(Inherited from EnableQueryAttribute.)

System_CAPS_pubmethod OnActionExecutedAsync(HttpActionExecutedContext, CancellationToken)

(Inherited from ActionFilterAttribute.)

System_CAPS_pubmethod OnActionExecuting(HttpActionContext)

Occurs before the action method is invoked.(Inherited from ActionFilterAttribute.)

System_CAPS_pubmethod OnActionExecutingAsync(HttpActionContext, CancellationToken)

(Inherited from ActionFilterAttribute.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod ValidateQuery(HttpRequestMessage, ODataQueryOptions)

Validates the OData query in the incoming request. By default, the implementation throws an exception if the query contains unsupported query parameters. Override this method to perform additional validation of the query.(Inherited from EnableQueryAttribute.)

Explicit Interface Implementations

Name Description
System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

(Inherited from Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

(Inherited from Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfoCount(UInt32)

(Inherited from Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

(Inherited from Attribute.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod IActionFilter.ExecuteActionFilterAsync(HttpActionContext, CancellationToken, Func<Task<HttpResponseMessage>>)

Executes the filter action asynchronously.(Inherited from ActionFilterAttribute.)

Remarks

If a Web API controller action returns an IQueryable, you can mark the action method with QueryableAttribute to support OData query parameters on the request URI.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

System.Web.Http Namespace

Return to top