Skip to main content

QueryParameterCollection Class

A query parameters collection.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v24.2.dll

Declaration

public class QueryParameterCollection :
    Collection<QueryParameter>

The following members return QueryParameterCollection objects:

Library Related API Members
Cross-Platform Class Library IChooseJsonSourcePageView.QueryParameters
UriJsonSource.QueryParameters
WinForms Controls ChooseJsonSourcePageView.QueryParameters

Remarks

Use query parameters to pass HTTP request parameters to a JSON endpoint.

Add query parameters to a QueryParameterCollection instance and assign the collection to the UriJsonSource.QueryParameters property.

The parameters are added to endpoint requests in the same order in which they are stored in the collection. Change the order of elements in the collection to reposition parameters in endpoint requests.

Example

The code sample below specifies a JSON endpoint and uses the date and id query parameters to identify the data record requested from the endpoint. The id query parameter is bound to the ID report parameter.

using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON source.
var jsonSource = new UriJsonSource() {
    Uri = new Uri(@"https://localhost:44367/api/values")
};
// Create the "date" and "id" query parameters that are appended to the JSON URI: https://localhost:44367/api/values/?date=2020-01-15&id=123.
jsonSource.QueryParameters.AddRange(new[] {
    new QueryParameter("date", typeof(String), String.Format("{0:yyyy-MM-dd}", DateTime.Today)),
    // "ID" is a report parameter whose value is used for the "id" query parameter.
    new QueryParameter("id", typeof(Expression), new Expression("?ID"))
});
// Assign the JSON source to the data source.
var datasource = new JsonDataSource() {
    JsonSource = jsonSource
};

Inheritance

Object
Collection<QueryParameter>
QueryParameterCollection
See Also