corelibraries-devexpress-dot-dataaccess-dot-json-e343d357.md
A JSON endpoint path parameters collection.
Namespace : DevExpress.DataAccess.Json
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
public class PathParameterCollection :
Collection<PathParameter>
Public Class PathParameterCollection
Inherits Collection(Of PathParameter)
The following members return PathParameterCollection objects:
| Library | Related API Members |
|---|---|
| Cross-Platform Class Library | IChooseJsonSourcePageView.PathParameters |
| UriJsonSource.PathParameters | |
| WinForms Controls | ChooseJsonSourcePageView.PathParameters |
Use path parameters to add path elements to a JSON endpoint’s Uri.
Add path parameters to a PathParameterCollection instance and assign the collection to the UriJsonSource.PathParameters 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.
The code sample below specifies a JSON endpoint and uses the date and id path parameters to identify the data record requested from the endpoint. The id path 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" path parameters that are appended to the JSON URI: https://localhost:44367/api/values/date/2020-01-15/id/123/.
jsonSource.PathParameters.AddRange(new[] {
new PathParameter("date", typeof(String), String.Format("{0:yyyy-MM-dd}", DateTime.Today)),
// "ID" is a report parameter whose value is used for the "id" path parameter.
new PathParameter("id", typeof(Expression), new Expression("?ID"))
});
// Assign the JSON source to the data source.
var datasource = new JsonDataSource() {
JsonSource = jsonSource
};
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.Json
' ...
' Create a new JSON source.
Dim jsonSource = New UriJsonSource() With {.Uri = New Uri("https://localhost:44367/api/values")}
' Create the "date" and "id" path parameters that are appended to the JSON URI: https://localhost:44367/api/values/date/2020-01-15/id/123/.
jsonSource.PathParameters.AddRange( {
New PathParameter("date", GetType(String), String.Format("{0:yyyy-MM-dd}", Date.Today)),
New PathParameter("id", GetType(Expression), New Expression("?ID"))
})
' "ID" is a report parameter whose value is used for the "id" path parameter.
' Assign the JSON source to the data source.
Dim datasource = New JsonDataSource() With {.JsonSource = jsonSource}
Object Collection<PathParameter> PathParameterCollection
See Also