mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Adds editorconfig and refactors to the established rules
This commit is contained in:
1 parent
712a0f2b27
commit
cd44f11d9e
138 files changed
+1799
-1629
No files matched your search
@@ -52,15 +52,15 @@ public class FluentValidationOptions<TOptions> : IValidateOptions<TOptions> wher
|
||||
|
||||
ArgumentNullException.ThrowIfNull(options, nameof(options)); // don't go further if the options are null
|
||||
|
||||
var validationResult = _validator.Validate(options); // validate the options using the validator
|
||||
FluentValidation.Results.ValidationResult validationResult = _validator.Validate(options); // validate the options using the validator
|
||||
|
||||
// return a response based on the validation result
|
||||
if (validationResult.IsValid)
|
||||
return ValidateOptionsResult.Success;
|
||||
|
||||
|
||||
// if the validation fails, collect the error messages
|
||||
// TODO: add translation support for the error messages
|
||||
var errors = validationResult.Errors.Select(x => $"Options validation failed for '{x.PropertyName}' with error: '{x.ErrorMessage}'")
|
||||
string[] errors = validationResult.Errors.Select(x => $"Options validation failed for '{x.PropertyName}' with error: '{x.ErrorMessage}'")
|
||||
.ToArray();
|
||||
|
||||
// and return them with a failure result
|
||||
|
||||
Reference in new issue
Block a user