MiniValidator.TryValidateAsync (or any other method) with recurse disabled
Object that has a property without any validation attribute example and which can:
Throw an exception (due to not implemented or temporal data inconsistency) from a property getter which is of a type that has at least one validation attribute
Trigger data (lazy) loading from a database that can lead, in specific scenarios, to deadlocks
For such a scenario, when we try to validate an instance of the class we get an exception (or data lazy loading) even though the engine shouldn't validate the problematic property - it doesn't have any validation attribute nor recurse is enabled.
Solution
Filter out properties without any validation attribute only when the recurse is disabled.
Context
We have:
MiniValidator.TryValidateAsync
(or any other method) withrecurse
disabledFor such a scenario, when we try to validate an instance of the class we get an exception (or data lazy loading) even though the engine shouldn't validate the problematic property - it doesn't have any validation attribute nor
recurse
is enabled.Solution
Filter out properties without any validation attribute only when the
recurse
is disabled.