Questions tagged [fluentvalidation-2.0]
39 questions
2
votes
1 answer
FluentValidation, how to include parent property name in child validator exception message
RuleFor(getEligibleShippingDetails => getEligibleShippingDetails.ShipFromAddress)
.NotNull()
.WithMessage("Ship from address is required.")
.SetValidator(shippingFromAddressValidator.FluentValidator)
The exception I'm getting is
Exception :…

schizofreindly
- 177
- 2
- 13
1
vote
1 answer
Clientside validation attributes on hidden,radio, dropdown elements by default in asp.net mvc 3
I'm using ASP.NET MVC 3 + FLUENT VALIDATION + NINJECT
I have model X and rules for that model are something like this:
RuleFor(c => c.FirstName).NotEmpty();
RuleFor(c => c.LastName).NotEmpty();
I spotted a little strange thing, the engine puts…

Marko
- 1,874
- 1
- 21
- 36
1
vote
1 answer
fluentvalidation multiple submit buttons, different validation scenarios
I have an address search area on my form in my asp.net mvc3 application. the whole form is submitted using the main submit button and the address search is initiated using the search button.
When the user submits the form using the search button…
user156888
1
vote
3 answers
How to apply Client Side validation using Fluent Validation for .Net core
.Net Core 3.0 MVC view. Needs to apply - Client Side validation for below model.
Tried as follow:
Model:Person
public class Person {
public int Id { get; set; }
public string Name { get; set; }
public string Email { get;…

user3711357
- 1,425
- 7
- 32
- 54
1
vote
1 answer
using must in fluentValidation
I am using FluentValidation for the server side validation. Now I want to call a function using must.
This is the form code snippet :
1
vote
1 answer
Attribute based validation with fluent validation doesn't seem to work with asp.net-mvc
i followed all of these steps in this tutorial:
Created a validator class
public class ProjectValidator : AbstractValidator
{
public ProjectValidator()
{
//RuleFor(h =>…

leora
- 188,729
- 360
- 878
- 1,366
1
vote
0 answers
FluentValidation on DateTime
I have following line of code for Data Annotation validation on PublishedDateTime field, but i would like validate through FluentValidation API
public Instant Published { get; set; }
[Obsolete("EF-serialization…

Urgen
- 1,095
- 3
- 19
- 39
1
vote
1 answer
Exclude "The value 'null' is not valid for ..." in ActionFilterAttribute
In a webapi project we have a model like:
public class Person
{
public string Name { get; set; }
public Guid? Id { get; set; }
}
We have configured validation of parameters and we do some checks using ActionFilterAttribute:
public class…

Cyan
- 1,068
- 1
- 12
- 31
1
vote
2 answers
FluentValidation NotNull on enum values
I have a model with enum property which based on 'int'.
I need to validate that this property is not empty. But NotEmpty forbids 0 value. And NotNull just doesn't work because enum property cannot be null.
I cannot make my property nullable.
How can…

ilyabreev
- 628
- 6
- 20
1
vote
0 answers
Fluent Validation - custom localization
Using FluentValidation I want to implement my own localization, as I translate my messages using a 3rd party service/source.
How do I replace LocalizedStringSource with my own implementation? Is it possible?
This is an idee ( Griffin localization…

Gradinariu Cezar
- 553
- 1
- 5
- 12
1
vote
2 answers
Set property is rule is valid with FluentValidation
I have a validator that looks like this
public class ImageValidator : AbstractValidator
{
public ImageValidator()
{
RuleFor(e => e.Name).NotEmpty().Length(1, 255).WithMessage("Name must be between 1 and 255 chars");
…

Gillardo
- 9,518
- 18
- 73
- 141
0
votes
2 answers
How do I validate ViewModels across an ASP.NET MVC and a Windows Phone Project?
I want to create an application that has both an ASP.NET MVC 3 web client and a Windows Phone 7 phone client. The application data is stored in SQL Server and needs to be accessed from both clients.
Given that scenario, I have two questions:
I want…

Marius Schulz
- 15,976
- 12
- 63
- 97
0
votes
2 answers
Fluentvalidation inject business object to validator
I am using fluentvalidation and use structuremap to inject validators for actions in asp.net mvc3. I have problems to inject my business objects to validator objects. I get an error like this:
{"StructureMap Exception Code: 202\nNo Default Instance…

Yorgo
- 2,668
- 1
- 16
- 24
0
votes
1 answer
Fluent validation to check list of objects Id's are not null or empty in C#
i have written one rule to check whether objects Id within list are not null or empty. But rule is not failing. Is any problem in here with my code ?
NOTE : Id's are of string type.
RuleFor(x => x.MyListOfObjects).Must(x => x.All(x =>…

Aԃιƚყα Gυɾαʋ
- 107
- 1
- 15
0
votes
0 answers
.NET FluentValidation: Parent rule depending on child value
I tried in this way but this doesn´t work properly:
RuleForEach(p => p.Childs).NotEmpty().ChildRules(child =>
{
child.RuleFor(p => p.Name).NotEmpty();
When(p => p.Child2.Name == "cool", () =>
{
…

pelotu2
- 35
- 5