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

Remove usage of async void #10

Open
mrpmorris opened this issue Jan 28, 2020 · 2 comments
Open

Remove usage of async void #10

mrpmorris opened this issue Jan 28, 2020 · 2 comments

Comments

@mrpmorris
Copy link
Owner

No description provided.

@sven5
Copy link

sven5 commented Apr 23, 2020

I was struggling to get async validation working.

RuleFor(x => x.FolderPath).MustAsync(ValidateFolderPath).WithMessage(o => "Invalid path.");

It's been working when changing the field's value but not when submitting the form.

The key is to change the code ValidationRequested event to run not async.

It's a little weird as the solution is to use sync Validate method of FluentValidation:

            // Tell FluentValidation to validate the object
            ValidationResult result = Validator.Validate(EditContext.Model);

@mrpmorris
Copy link
Owner Author

It's tricky in validation because none of the Blazor EditContext stuff is async, which is partly why I haven't started to tackle this yet.

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

2 participants