Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature : Multiple validation context support #511

Open
brignolff opened this issue Feb 27, 2023 · 0 comments
Open

feature : Multiple validation context support #511

brignolff opened this issue Feb 27, 2023 · 0 comments

Comments

@brignolff
Copy link

Is your feature request related to a problem? Please describe.
Had a case where i needed to have validations that stop and block an external process and others that simply display the error without blocking or stopping anything. I also needed to display these validations separately.

Describe the solution you'd like
I thinked of having multiple validation contexts in a single ViewModel. To do so I made overloads for the "ValidationRule(...)" and "BindValidation(...)" methods. I added a "Func<TViewModel, ValidationContext> validationContextProperty" parameter to those methods and use it instead of the one present by default in the "IValidatableViewModel" interface.

Describe alternatives you've considered
An alternative could have been to create multiple validation classes inheriting from IValidationComponent but that also means adding methods to add them to the validation context. I would also need to create functions to filter them in order to know if a validation of type x is false.

Describe suggestions on how to achieve the feature
Made modifications of the code of this repo and uploaded everything on this github in the multiple validation context branch.
https://github.com/brignolff/Mdified.ReactiveUI.Vaidation/tree/multiple_validation_contexts

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

No branches or pull requests

1 participant