Skip to content

Conversation

@Kraviecc
Copy link
Contributor

Context

We have:

  • 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.

that don't have any validation attribute and when recurse is disabled
@Kraviecc
Copy link
Contributor Author

hey @DamianEdwards, do you have time to review the changes?

@Kraviecc Kraviecc force-pushed the feature/omit-unnecessary-prop-evaluation branch from 1abda3d to d618f6e Compare July 8, 2024 09:10
Copy link
Owner

@DamianEdwards DamianEdwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this!

@DamianEdwards DamianEdwards merged commit 708584e into DamianEdwards:main Dec 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants