You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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.
0 commit comments