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 | |
---|---|---|
QueryableAttribute() | Initializes a new instance of the QueryableAttribute class. |
Properties
Name | Description | |
---|---|---|
AllowedArithmeticOperators | Gets or sets a value that represents a list of allowed arithmetic operators including 'add', 'sub', 'mul', 'div', 'mod'.(Inherited from EnableQueryAttribute.) |
|
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.) |
|
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.) |
|
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.) |
|
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.) |
|
AllowMultiple | Gets a value that indicates whether multiple filters are allowed.(Inherited from FilterAttribute.) |
|
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.) |
|
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.) |
|
HandleNullPropagation | Gets or sets a value indicating how null propagation should be handled during query composition.(Inherited from EnableQueryAttribute.) |
|
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.) |
|
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.) |
|
MaxNodeCount | Gets or sets the maximum number of nodes inside the $filter syntax tree. The default value is 100.(Inherited from EnableQueryAttribute.) |
|
MaxOrderByNodeCount | Gets or sets the maximum number of expressions that can be present in the $orderby.(Inherited from EnableQueryAttribute.) |
|
MaxSkip | Gets or sets the max value of $skip that a client can request.(Inherited from EnableQueryAttribute.) |
|
MaxTop | Gets or sets the max value of $top that a client can request.(Inherited from EnableQueryAttribute.) |
|
PageSize | Gets or sets the maximum number of query results to send back to clients.(Inherited from EnableQueryAttribute.) |
|
TypeId | (Inherited from Attribute.) |
Methods
Name | Description | |
---|---|---|
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.) |
|
ApplyQuery(Object, ODataQueryOptions) | Applies the query to the given entity based on incoming query from uri and query settings.(Inherited from EnableQueryAttribute.) |
|
Equals(Object) | (Inherited from Attribute.) |
|
Finalize() | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Attribute.) |
|
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.) |
|
GetType() | (Inherited from Object.) |
|
IsDefaultAttribute() | (Inherited from Attribute.) |
|
Match(Object) | (Inherited from Attribute.) |
|
MemberwiseClone() | (Inherited from Object.) |
|
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.) |
|
OnActionExecutedAsync(HttpActionExecutedContext, CancellationToken) | (Inherited from ActionFilterAttribute.) |
|
OnActionExecuting(HttpActionContext) | Occurs before the action method is invoked.(Inherited from ActionFilterAttribute.) |
|
OnActionExecutingAsync(HttpActionContext, CancellationToken) | (Inherited from ActionFilterAttribute.) |
|
ToString() | (Inherited from Object.) |
|
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 | |
---|---|---|
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
|
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
|
_Attribute.GetTypeInfoCount(UInt32) | (Inherited from Attribute.) |
|
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | (Inherited from Attribute.) |
|
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
Return to top