-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ValidateAsync method to use FV async validation (#344)
- Loading branch information
Showing
4 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
namespace ValidatorOnlyProject | ||
{ | ||
using System.Threading.Tasks; | ||
using FluentValidation; | ||
|
||
public class CastMemberValidator : AbstractValidator<CastMember> | ||
{ | ||
public CastMemberValidator() | ||
{ | ||
this.RuleFor(x => x.Name).NotEmpty(); | ||
this.RuleFor(x => x.Name).NotEmpty().MustAsync(async (name, cancellation) => | ||
{ | ||
await Task.Delay(50); | ||
return true; | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3a0729d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this, I would have done a PR request myself, but I wanted to see if there was a reason for it or not being implemented first. You are awesome for being so fast on this. Carter is really great. Thank you