Questions tagged [fluentvalidation]

Fluent Validation is an ASP.NET MVC integrated validation framework that allows the developer to set validation rules using expressions. It is testable and completely compatible with the inversion of control (dependency injection) pattern and TDD (test-driven development) technique.

Fluent Validation is an open-source, ASP.NET MVC / ASP.NET Core integrated validation framework that allows the developer to set validation rules using expressions. It is testable and completely compatible with the Inversion-of-Control (dependency injection) pattern and TDD (test-driven development) technique.

It is one of a number of validation options, including Data Annotations.

Visit the official website to learn more.

Source code can be found here.

1427 questions
0
votes
0 answers

fluent validation custom message depending on another property

I have this Entity public class Entity { [Key] public int Id { get; set; } public int RequestTypeId { get; set; } public int DepartmentTypeId { get; set; } ... } I want to display a different error…
Valter
  • 2,859
  • 5
  • 30
  • 51
0
votes
1 answer

Fluent Validation with ASP.NET MVC 5

We've MVC-2 application with Fluent Validation (Visual Studio 2010). Recently we migrated it to Visual Studio 2013, MVC 5. After upgrading the Fluent Validation with NuGet, I get the compilation error for following members. Can't find namespace…
gmail user
  • 2,753
  • 4
  • 33
  • 42
0
votes
1 answer

How to show errors on in the view from a fluentvalidation result in a asp.net mvc 2 app?

I am learning asp.net mvc 2 and fluent validation. My setup is shown after the text here. My problem is that I do not know how to set the errors contained in the res object on the view page in a nice way. How should this be done? As it is now no…
0
votes
3 answers

FluentValidation message appears, but form submits anyway

Using MVC4 with FluentValidation. I have a field with two rules on it. The NotEmpty rule works as expected. The Matches rule seems to fire, but the form submits anyway, even though the validation message pops up as if it's failing validation. I…
Mike
  • 399
  • 2
  • 9
  • 19
0
votes
1 answer

Install-Package FluentValidation always fail

I want to install FluentValidation ,but I fail every time.
一无所有
  • 101
  • 8
0
votes
1 answer

Client Side Validation Using Custom Validator FluentValidation MVC

I have seen many examples of using FluentValidation here but none seem to fit my need. I have an existing server side implementation and based on answers here, I am convinced I have to change my implementation to get it work client side. One reason…
Shawn Doe
  • 145
  • 1
  • 2
  • 11
0
votes
1 answer

FluentValidation exception, abstractValidator cs not found

I am doing UnitTest,when ever debug the method it throws exception saying AbstractValidator.cs not found, ValidationTestExtension.cs not found and i re-install the FluentValidation, fluentValidation.mvc5 but couldn't resolve,..what should i do?
abcool
  • 95
  • 1
  • 10
0
votes
1 answer

Resolving and registering RequestContext in WebApi using StructureMap

I successfuly configured FluentValidator (FluentValidationModelValidatorProvider) in WebApi 2 to do validation when validator exist for web api method parameter. Now I would like to implement validation in custom AbstractValidator class. I need…
marcinn
  • 1,879
  • 2
  • 22
  • 46
0
votes
1 answer

JQuery with Asp.net validation

I have a form that displays an asp.net grid with different people listed in the grid. A user can add new user's to the grid, by clicking an asp.net button on the page:
0
votes
1 answer

Pass Class Property as Generic Type

I am attempting to implement a base class for FluentValidation that will quickly build a validator for classes. My base class functions attempt to take a class's property as a Generic type argument in order to apply rules. But as you'll see in the…
sazr
  • 24,984
  • 66
  • 194
  • 362
0
votes
2 answers

NuGet Fails to Install FluentValidation

I am attempting to install the NuGet package Nancy.Validation.FluentValidation but the installation fails due to, I think, unsupported frameworks? The full NuGet error is below. I am using .NET 4.5. I cant see why it would fail? Any ideas what is…
sazr
  • 24,984
  • 66
  • 194
  • 362
0
votes
1 answer

How to replace the default web api model validation with Fluent Validation

[Validator(typeof(ProductDetailsRequestDTO))] public class ProductDetailsRequestDTO { public int ArticleGroup { get; set; } public DateTime ProducedAt { get; set; } } public class ProductDetailsRequestDTOValidator :…
Pascal
  • 12,265
  • 25
  • 103
  • 195
0
votes
1 answer

FluentValidation to validate the length of a disparate collection

Given the following seven data elements, I must create a validation rule that the collective length of the elements does not exceed 315 characters. AssetType is an enumerator of types and if one of those types does not accurately describe the asset,…
PEdwards
  • 1
  • 1
0
votes
1 answer

How do you get the validators implementing the Fluentvalidation API in ASP.Net WebAPI

Example: public class UserValidator : AbstractValidator { public UserValidator() { RuleFor(p => p.Username).NotEmpty() .WithMessage("Please enter a username."); } } public class UserController :…
0
votes
1 answer

ServiceStack FluentValidation - Issue with Multiple RuleSets

I have a validator with two RuleSets. The first RuleSet has 4 rules and the second has 2 rules. When I call Validate with each RuleSet individually, I get the correct number of errors (4 and 2) but when I call them together, I get NO errors... …
user2220004
  • 109
  • 5