Skip to content

Commit 4832726

Browse files
committed
[C#] Add validation to DTOs and improve use of records.
The aim of these changes are to avoid multiple representations in DTOs and to support read-only views over data. The new validation includes: - Checking null values "idiomatic null values" rather than the reserved null value, to prevent against multiple kinds of null in DTOs. - Checking primitive field values are at least `minValue` and at most `maxValue`. Note that this validation is not applied to fixed-size arrays as the specification says, "Data range attributes minValue and maxValue do not apply", under the "Fixed-length data" section. Records are now immutable. Record expressions, i.e., using `with`, are supported and will apply validation, as we have customised the `init` property accessor. I have not included support for encoding null composite values from DTOs; however, in theory, this could be added later.
1 parent c205d2e commit 4832726

File tree

2 files changed

+278
-76
lines changed

2 files changed

+278
-76
lines changed

0 commit comments

Comments
 (0)