XDefaultAttribute Class
Defines the default value of a service operation parameter, or of a member of a class used by the API.
Remarks
Delphi default parameter values are only available at compile time, so XData cannot use them when a raw HTTP request omits the parameter. Add this attribute to the parameter in the service contract interface, repeating the default value, to make the parameter optional in HTTP requests, as in function Hello([XDefault('World')] const Name: string = 'World'): string;. The default value is also shown in the generated API documentation. Attributes in the service implementation class are ignored.
Syntax
Unit: XData.Service.Common
XDefaultAttribute = class(DefaultAttribute);
Constructors
| Name | Description |
|---|---|
| Create | Defines a boolean default value. |