Run validation in an async context to allow async rules in FluentValidation v11
Is your feature request related to a problem? Please describe. Until now FluentValidation, async rules were silently run as synchronous, so they could be used. Since v11, it now throws an exception when an async rule is executed synchronously, a lot of our validators are now throwing exceptions when validating a command.
Describe the solution you'd like Very very quickly looking at the code, it looks like the Validate() is already running in an async context. So it should be possible to call ValidateAsync instead of Validate, allowing to use async rules without too much impact. Could it be possible to change the code to do that ?
This PR fixes the issue on our projects.
I don't suggest that this is merged as-is as it might add an async overhead for projects that don't use async validation rules which might have performance impacts. Maybe add another pipeline for async and another extension method / option to choose which one to inject ?
Hello, any updates on this?
Resolved in new version https://github.com/GetoXs/MediatR.Extensions.FluentValidation.AspNetCore/releases/tag/5.0.0
Based on CleanArchitecture solution https://github.com/jasontaylordev/CleanArchitecture/blob/main/src/Application/Common/Behaviours/ValidationBehaviour.cs