ExistsReferenceByIdParams
The existsReferenceByIdParams section allows you to set up a validation for a property of your entity that represents a foreign key, whose purpose is to ensure that the Id of that reference exists in the database before the information is persisted.
This approach allows you to act proactively regarding error handling, avoiding database exceptions.
Fields
A existsReferenceByIdParams contains the following fields to be defined:
PropertyName
The name of entity property to which validation will be applied. This property normally represents a foreign key.
Requirements Rules:
- Is Required;
- The name must exist in the Properties list for the validation entity;
- The type of this property must be the same as the KeyType of the related entity
Example:
1 2 |
|
RepositoryName
The name of repository to be used to perform the query operation.
Requirements Rules:
- Is Required;
- The name must exist in Repositories list in the current model;
- See Repository section for more details.
Note
You must inform a repository that manages the foreign entity.
Example:
1 2 3 |
|
ErrorCode
Allows you to define an error code for when the current validation fails.
Example:
1 2 3 4 |
|
Message
Allows you to define an error message for when the current validation fails.
Example:
1 2 3 4 5 |
|