fluentvalidation Questions
7
Solved
Hello I am trying to get custom validation response for my webApi using .NET Core.
Here I want to have response model like
[{
ErrorCode:
ErrorField:
ErrorMsg:
}]
I have a validator class an...
Dextroamphetamine asked 18/8, 2017 at 13:35
6
Solved
For example I have validator with two validation rules:
// Rule 1
RuleFor(o => o.Email).Must((email) => this.GetDataDataFromDB(email) != 0)
.WithMessage("User with provided Email was not fo...
Archimage asked 27/5, 2016 at 13:27
4
Solved
I have a model:
public class DTO
{
public int[] StatementItems { get; set; }
}
Which I want to validate that:
StatementItems is not null
StatementItems is not empty
StatementItems does not c...
Sandwich asked 7/2, 2017 at 21:23
5
Solved
Can I add more than one validator to an object? For example:
public interface IFoo
{
int Id { get; set; }
string Name { get; set; }
}
public interface IBar
{
string Stuff { get; set; }
}
pub...
Figwort asked 2/11, 2012 at 15:38
4
I have a C# WebApi project and i am using FluentValidation.WebApi package for validation of client inputs.
Below is my model class code which has C# property named "IsPremium". This same property ...
Vinavinaceous asked 8/8, 2016 at 13:9
3
Solved
I have a MediatR Pipeline behavior for validating commands with the FluentValidation library. I've seen many examples where you throw a ValidationException from the behavior, and that works fine fo...
Jasun asked 9/1, 2019 at 6:8
4
I'm struggling with implementing a validator for a class, where only one property should be set.
Let's say we have the following class:
public class SomeClass
{
public DateTime SomeDate {get; set;...
Oleomargarine asked 24/3, 2021 at 15:24
2
Probably very silly issue but looking for help on this .
I am adding MVC Fluent validation rules to model property but for some reason one of the validation rule is failing. Added a regular expre...
Unprofessional asked 17/12, 2014 at 22:56
1
I am allowing a client to make events to display, those dates have ToDate and FromDate, I need to check if the ToDate is in the future or the same as the FromDate; I used this fluent validation.
p...
Vories asked 14/3, 2017 at 14:39
3
Solved
I have the following model:
public class ViewDataItem
{
public string viewName { get; set; }
public UpdateIndicator updateIndicator { get; set; }
}
With the following enum:
public enum Update...
Voorhees asked 10/7, 2017 at 13:51
5
Solved
I'm using FluentValidation and trying to create a rule that throws error if there is any whitespace in the string, i.e. for a username.
I've reviewed these SOs, but doesn't seem to work, I'm sure ...
Steck asked 11/3, 2014 at 21:34
7
Solved
I have this model
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
I want to create a validation where either Fi...
Gualterio asked 14/1, 2014 at 13:49
3
Solved
What are the operative differences between these two validation packages when used for ASP.NET MVC validatation? They seem to have similar objects, all the way to their object names. Is one related...
Necaise asked 24/7, 2011 at 14:43
4
Solved
From the FluentValidation documentation I learned that I can abort validation by setting the cascade mode.
RuleFor(x => x.Surname)
.Cascade(CascadeMode.StopOnFirstFailure)
.NotNull()
.NotEqual(...
Sprocket asked 20/1, 2014 at 19:47
5
The problem
I'm struggling to make my Fluent Validation RuleSet work, currently it doesn't, and I don't have any idea why is that happening, everything seems all right. I would like to somehow step...
Mcbryde asked 20/7, 2013 at 23:4
2
Solved
If I have the following rule:
if (a == true && b == 0)
return errorsenum.somerror1;
else if (b < c)
return errorsenum.somerror2;
How can I implement the above as a FluentValidation ...
Dell asked 20/4, 2016 at 12:4
2
Solved
I'm currently in the process of learning Blazor (with MudBlazor) using FluentValidation. I'm largely going off what's in the MudBlazor docs for patterns and practices. I've got a top-level form (Ma...
Harilda asked 4/10, 2022 at 14:59
2
Solved
I'm using FluentValidation to validate an object, and because this object has a collection member I'm trying to use RuleForEach. For example, suppose we have Customer and Orders, and we want to ens...
Lackluster asked 30/11, 2014 at 12:8
5
Solved
I'm having a play around with http://fluentvalidation.codeplex.com/ to validate some domain models.
I have a typical scenario where I want to validate a string, for example...
RuleFor(x => x.M...
Oneway asked 13/2, 2014 at 14:17
4
Is it possible to write unit tests for fluentvalidation classes when the object we are validating has child classes that are also being validated.
As an example:
My class looks like this
public ...
Bringingup asked 17/12, 2012 at 13:50
3
I was referred to using FluentValidation for use in MVC5 C# ASP.NET. I am trying to compare a field to two other fields but am getting an error.
The code in my customized "AbstractValidator" is th...
Carbolated asked 15/6, 2015 at 20:47
11
Solved
I've been trying to work out how to create a FluentValidation rule that checks if the instance of an object it's validating is not null, prior to validating it's properties.
I'd rather encapsulat...
Technical asked 13/6, 2013 at 19:51
3
I'm using the FluentValidation library in an ASP.NET MVC project and, from a UI perspective, it's working as expected. Rule violations display the correct errors.
I have a parent class that has a...
Branca asked 5/2, 2015 at 21:57
3
Solved
I'm trying to use FluentValidation to validate based on object.GetType() rather than knowing the type at compile time by injecting IValidator<T>, but I am getting null values instead of a val...
Gazebo asked 21/4, 2022 at 15:10
3
Solved
I've started using FluentValidation on a WPF project, till now I used it in a simple way checking if a field has been filled or less then n character.
Now I've to check if the value inserted (which...
Selfassertion asked 5/11, 2019 at 15:53
1 Next >
© 2022 - 2025 — McMap. All rights reserved.