The Parameter
object defines an Operation
parameter and its charateristics.
A YAML configuration example is as follows:
parameters: [
{ name: Id, property: Id, isMandatory: true, validatorCode: Common(EmployeeValidator.CanDelete) }
]
The Parameter
object supports a number of properties that control the generated code output. These properties are separated into a series of logical categories.
Category | Description |
---|---|
Key |
Provides the key configuration. |
Property |
Provides the Property reference configuration. |
RefData |
Provides the Reference Data configuration. |
Manager |
Provides the Manager-layer configuration. |
Data |
Provides the data configuration. |
WebApi |
Provides the Web API configuration. |
gRPC |
Provides the gRPC configuration. |
The properties with a bold name are those that are more typically used (considered more important).
Provides the key configuration.
Property | Description |
---|---|
name |
The unique parameter name. [Mandatory] |
text |
The overriding text for use in comments. † By default the Text will be the Name reformatted as sentence casing. |
type |
The .NET Type .† Defaults to string . To reference a Reference Data Type always prefix with RefDataNamespace (e.g. RefDataNamespace.Gender ) or shortcut ^ (e.g. ^Gender ). This will ensure that the appropriate Reference Data using statement is used. Shortcut: Where the Type starts with (prefix) RefDataNamespace. or ^ , and the correspondong RefDataType attribute is not specified it will automatically default the RefDataType to string. |
nullable |
Indicates whether the .NET Type should be declared as nullable; e.g. string?. Will be inferred where the Typeis denoted as nullable; i.e. suffixed by a ?`. |
default |
The C# code to default the value. † Where the Type is string then the specified default value will need to be delimited. Any valid value assignment C# code can be used. |
privateName |
The overriding private name. † Overrides the Name to be used for private fields. By default reformatted from Name ; e.g. FirstName as _firstName . |
argumentName |
The overriding argument name. † Overrides the Name to be used for argument parameters. By default reformatted from Name ; e.g. FirstName as firstName . |
Provides the Property reference configuration.
Property | Description |
---|---|
property |
The Property.Name within the parent Entity to copy (set) the configuration/characteristics from where not already defined. |
Provides the Reference Data configuration.
Property | Description |
---|---|
refDataType |
The underlying Reference Data Type that is also used as the Reference Data serialization identifier (SID). Valid options are: string , int , Guid .† Defaults to string where not specified and the corresponding Type starts with (prefix) RefDataNamespace. . |
refDataList |
Indicates that the Reference Data property is to be a serializable list (ReferenceDataSidList ).† This is required to enable a list of Reference Data values (as per RefDataType ) to be passed as an argument for example. |
Provides the Manager-layer configuration.
Property | Description |
---|---|
validator |
The name of the .NET Type that will perform the validation. |
iValidator |
The name of the .NET Interface that the Validator implements/inherits.† Defaults to IValidator<{Type}> where the {Type} is Type . |
validatorCode |
The fluent-style method-chaining C# validator code to append to IsMandatory and Validator (where specified). |
isMandatory |
Indicates whether a ValidationException should be thrown when the parameter value has its default value (null, zero, etc). |
layerPassing |
The option that determines the layers in which the parameter is passed. Valid options are: All , ToManagerSet , ToManagerCollSet .† Defaults to All . To further describe, All passes the parameter through all layeys, ToManagerSet only passes the parameter to the Manager layer and overrides the same named property within the corresponding value parameter, ToManagerCollSet only passes the parameter to the Manager layer and overrides the same named property within the corresponding value collection parameter. Where using the UniqueKey option to automatically set Parameters , and the Operation.Type is Create or Update it will default to ToManagerSet . |
Provides the data configuration.
Property | Description |
---|---|
dataConverter |
The data Converter class name where specific data conversion is required.† A Converter is used to convert a data source value to/from a .NET Type where the standard data type conversion is not applicable. |
dataConverterIsGeneric |
Indicates whether the data Converter is a generic class and will automatically use the corresponding property Type as the generic T . |
Provides the Web API configuration.
Property | Description |
---|---|
webApiFrom |
The option for how the parameter will be delcared within the Web API Controller. Valid options are: FromQuery , FromBody , FromRoute , FromEntityProperties .† Defaults to FromQuery ; unless the parameter Type has also been defined as an Entity within the code-gen config file then it will default to FromEntityProperties . Specifies that the parameter will be declared with corresponding FromQueryAttribute , FromBodyAttribute or FromRouteAttribute for the Web API method. The FromEntityProperties will declare all properties of the Entity as query parameters. |
Provides the gRPC configuration.
Property | Description |
---|---|
grpcType |
The underlying gRPC data type; will be inferred where not specified. |