I have an async method that evaluates a field.
Task<bool> MyMethod(object obj);
I want to create a custom validation attribute that uses the above method.
My problem is that the ValidationAttribute class does not support async methods.
I usually override the following method:
ValidationResult IsValid (object? obj, ValidationContext validationContext);
But the output of my async method is Task<ValidationResult> and I don't want to use synchronous method.
Do you have a solution or suggestion?
Tip: I want to use the async method because of I/O blocking. (No CPU bound or heavy operations.)