Defensive coding using various libraries
I m adding defensive coding
to a dummy service/repository sample with the following libraries :
- CodeContracts : a great microsoft library for making preconditions, postconditions and invariants on code but seems to be no maintained (no support for .net core)
- Pitcher : a library for throwing a meaningful exception when some condition is not met by code (support for .net core)
- DawnGuard : another library for throwing a meaningful exception when some condition is not met by code (support for .net core)
- EnsureThat : an extensible library for throwing a meaningful exception when some condition is not met by code (support for .net core)
- GuardClauses : a nice library for throwing a meaningful exception when some condition is not met by code (support for .net core)
- LightGuardClauses : a rich and user friendly library for throwing a meaningful exception when some condition is not met by code (support for .net core)
- Throw : a fluent, extensible, and customizable library for throwing a meaningful exception when some condition is not met by code (support for .net core)
Tools
: vs22, net 6, net full 4.8