Skip to content

Conversation

@mosha99
Copy link

@mosha99 mosha99 commented Dec 17, 2025

This PR refactors the validation infrastructure to improve readability,
reduce unnecessary object instantiation, and minimize reflection usage,
while preserving existing behavior.

Key changes

  1. Refactored RegisterValidatorsAsServices

    • Simplified the registration logic for better readability
    • Removed the need to instantiate objects solely for applying validation rules
    • Introduced a generic static helper method and invoked it via reflection,
      reducing overall reflection usage and improving maintainability
  2. Updated ValidateApplicationModel

    • Changed from a regular interface method to a static abstract method
    • Allows invocation without creating new instances
    • Enables cleaner switching logic inside generic methods
  3. Updated implementations of IValidatableModel

    • Aligned all implementing types with the new static abstract contract
    • No behavioral changes in validation results

Notes

  • No breaking changes in public behavior
  • Focused on internal refactoring and performance/readability improvements

@babaktaremi
Copy link
Owner

Hi, thanks for your contribution! Overall, it looks good, but there are still some important improvements from previous versions that haven’t been addressed. Refactoring those would make a significant impact.

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