-
Notifications
You must be signed in to change notification settings - Fork 8
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
How do I use this for Async validation? #48
Comments
Hi @acnicholls-kroll, could you share some examples of what you're aiming to achieve? I'm currently using async validation with constructor injection in validators without any issues. I'd be curious to see how you’ve set everything up. |
I have written All my Validators inherit from
In addition, FV's GetServiceProvider does not work in this context, only if the validator is being used as an attribute, The fact that even that usage is being obsoleted just makes this method of validation seem unsuitable for this application, unless I can make it all work in an async manner The crux of the matter when these
the same repository instance goes into each rule method at the same time and EFCore complains about two (or more) concurrent operations. so I'd be more interested to see what you have working, rather than trying to explain what I have that doesn't work.... |
I don't do any injects in extension methods. Normally I create something like a |
does your |
@acnicholls-kroll I am using construction injection. Not sure what you mean with overkill, I prefer construction injection. |
Closing since this isn't a bug within the library. |
Hi,
I've just found your tool and after spending a few minutes looking at the documentation and trying to use the package in my solution, I see that it's not working quite yet.
I have added "AutoValidation" with "All" strategy, but am not seeing the validators hit, and when I do, I'm seeing this error
The service provider has not been configured to work with FluentValidation. Making use of InjectValidator or GetServiceProvider is only supported when using the automatic MVC integration.
I thought that using this package would allow for using
MustAsync
on my RuleFor statements. How do I use this package to enable using IServiceProvider in my validators? I am using theValidationContext.GetRequiredService
method in my validators to find my services, but as you see above, this does not seem to be possible.The text was updated successfully, but these errors were encountered: