This repository was archived by the owner on Dec 26, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 93
[Question] Silently validate model / TryValidate() #236
Copy link
Copy link
Open
Labels
QuestionQuestion about this projectQuestion about this projectTriageIssue needs to be triagedIssue needs to be triaged
Description
Hi,
I'm looking for a way to silently validate an EditContext when using FluentValidation, i.e. Validate without generating ValidationMessages. This feature is quite useful, e.g. to disable/enable a submit button.
When using DataAnnotationsValidator this is possible by calling Validator.TryValidateObject() like:
bool FormIsValid()
{
var validationResults = new List<ValidationResult>();
var validationContext = new ValidationContext(EditContext.Model);
Validator.TryValidateObject(EditContext.Model, validationContext, validationResults, true);
return !validationResults.Any();
}
Unfortunately I don't fully understand the way FluentValidation is hooked up into EditContext, but perhaps someone had an idea or already implemented something similiar and can get me on the right track.
Thanks in advance
Jake
Metadata
Metadata
Assignees
Labels
QuestionQuestion about this projectQuestion about this projectTriageIssue needs to be triagedIssue needs to be triaged