-
Notifications
You must be signed in to change notification settings - Fork 154
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
Unable to find a way to have this work with custom validations #273
Comments
I am not sure I fully understand the question. As a better option take a look a the CommunityToolkit.Mvvm package. It comes with some nice APIs for doing validation. You can see the documentation for it here: https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/observablevalidator |
It appears it is not an issue with the Abstract class itself but with Reflection, near as I can tell. When we tried to access the IsValid overload to utilize the ValidationContext it only shows the one method with only one parameter. So we had to call GetValidationResults instead within that overload. Sort of hacky but it worked(ish) My shop tends to shy away from open source libraries, I realize that the microsoft solution is deprecated but we are on some seriously legacy stuff so this should work for now. We will revist when/if we ever get to rework this to API and CORE tech. I am currently trying to find a way to extend you Abstract class to include IValidatableObject so that I can custom validate on multiple properties. Hoping this will alleviate the event conflicts I am getting. I have the need to show propA and/or propB as red if one or the other is of a specific value that violates invalid combinations. Another concern is that I am getting a pretty hard performance hit on one custom validation but I am fairly certain this is just my LINQ logic being expensive. |
I am also having trouble displaying all current errors in the template, having trouble finding a primer on the parts of the template for display. |
Specifically, when you are in need of the ValidationContext in the IsValid overload for ValidationAttribute.
GetCustomAttributes only returns the one method for use.
The text was updated successfully, but these errors were encountered: