Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EnableQueryAttribute Class

 

This class defines an attribute that can be applied to an action to enable querying using the OData query syntax. To avoid processing unexpected or malicious queries, use the validation settings on EnableQueryAttribute to validate incoming queries. For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.

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

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

[AttributeUsageAttribute(AttributeTargets::Class | AttributeTargets::Method, 
	Inherited = true, AllowMultiple = false)]
public ref class EnableQueryAttribute : ActionFilterAttribute

NameDescription
System_CAPS_pubmethodEnableQueryAttribute()

Enables a controller action to support OData query parameters.

NameDescription
System_CAPS_pubpropertyAllowedArithmeticOperators

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

System_CAPS_pubpropertyAllowedFunctions

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]

System_CAPS_pubpropertyAllowedLogicalOperators

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

System_CAPS_pubpropertyAllowedOrderByProperties

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.

System_CAPS_pubpropertyAllowedQueryOptions

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.

System_CAPS_pubpropertyAllowMultiple

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

System_CAPS_pubpropertyEnableConstantParameterization

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

System_CAPS_pubpropertyEnsureStableOrdering

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

System_CAPS_pubpropertyHandleNullPropagation

Gets or sets a value indicating how null propagation should be handled during query composition.

System_CAPS_pubpropertyMaxAnyAllExpressionDepth

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.

System_CAPS_pubpropertyMaxExpansionDepth

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

System_CAPS_pubpropertyMaxNodeCount

Gets or sets the maximum number of nodes inside the $filter syntax tree. The default value is 100.

System_CAPS_pubpropertyMaxOrderByNodeCount

Gets or sets the maximum number of expressions that can be present in the $orderby.

System_CAPS_pubpropertyMaxSkip

Gets or sets the max value of $skip that a client can request.

System_CAPS_pubpropertyMaxTop

Gets or sets the max value of $top that a client can request.

System_CAPS_pubpropertyPageSize

Gets or sets the maximum number of query results to send back to clients.

System_CAPS_pubpropertyTypeId

(Inherited from Attribute.)

NameDescription
System_CAPS_pubmethodApplyQuery(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.

System_CAPS_pubmethodApplyQuery(Object^, ODataQueryOptions^)

Applies the query to the given entity based on incoming query from uri and query settings.

System_CAPS_pubmethodEquals(Object^)

(Inherited from Attribute.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Attribute.)

System_CAPS_pubmethodGetModel(Type^, HttpRequestMessage^, HttpActionDescriptor^)

Gets the EDM model for the given type and request. Override this method to customize the EDM model used for querying.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodIsDefaultAttribute()

(Inherited from Attribute.)

System_CAPS_pubmethodMatch(Object^)

(Inherited from Attribute.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodOnActionExecuted(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.(Overrides ActionFilterAttribute::OnActionExecuted(HttpActionExecutedContext^).)

System_CAPS_pubmethodOnActionExecutedAsync(HttpActionExecutedContext^, CancellationToken)

(Inherited from ActionFilterAttribute.)

System_CAPS_pubmethodOnActionExecuting(HttpActionContext^)

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

System_CAPS_pubmethodOnActionExecutingAsync(HttpActionContext^, CancellationToken)

(Inherited from ActionFilterAttribute.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodValidateQuery(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.

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

Return to top
Show: