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
1 answer

How to validate multiField in MVC 3?

how to validate MultiFieldRequired as one property to output one error message , and integrated with jquery client validation in mvc3 ? i tried with MultiFieldRequired here , but there is no client validation message . can fluentvalidation.net…
-1
votes
1 answer

Email regex used Jquery does not work in .Net C#

CONTEXT: I have an email regex that is used in jquery while registration of users which goes as follows. It was already present in the database before I began with the project and I assume it is…
-1
votes
1 answer

NUnit tests failed with FLuentValidation in ONion Architecture

Im trying to implement nunit tests with fluentvalidations, but it shows me a failed test and the message: FluentValidation.AsyncValidatorInvokedSynchronouslyException : Validator "AddVehicleCommandValidator" contains asynchronous rules but was…
-1
votes
2 answers

fluent validator in class library not work in asp.net core

when i put fluent validators in asp.net core client side validation project exactly work but when i put validator in class library not work My model and validator in class library : using FluentValidation; namespace ClassLibrary1 { public class…
-1
votes
2 answers

How to create a base FluentValidation

namespace Test { public class A { public string Name { get; set; } } public class AValidator : AbstractValidator { public AValidator() { RuleFor(t => t.Name) …
Alex
  • 8,908
  • 28
  • 103
  • 157
-1
votes
1 answer

FluentValidation with Owin ignores [FromUri] Dtos in Asp.Net WebApi2

I'm developing an ASP.NET WebApi2 (.NET 4.7.2) with Owin and Autofac as IOC container. The Dtos shall get validated with FluentValidation before reaching the controller. Here is my project configuration: public class Startup { public void…
MatterOfFact
  • 1,253
  • 2
  • 18
  • 49
-1
votes
1 answer

FluentValidation Transform

I would like to use FluentValidation to change the format of an input based on a second value The example in the FluentValidation documentation I am following is: (although my values are all strings) Transform(x => x.SomeStringProperty,…
-1
votes
1 answer

FluentValidations: WithMessage to include parent data?

Newbie. I have a validation that ensures the Order's Total Sale is above $0. In the error message I need to include the Order ID. Something like this RuleForEach(x => x.Orders).ChildRules(order => { order.RuleFor(x =>…
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
-1
votes
1 answer

Refactoring multiple await calls that are self dependent

I had to investigate some exception at production, and then I found this code that uses FluentValidation: (inside async method) var validator = new SomeCustomValidator(); var validationResult =…
Sawd
  • 185
  • 3
  • 13
-1
votes
1 answer

Fluent validation for httpget request webapi core 3.0

public async Task GetCustomerById(int id) { var data = await _customerService.GetCustomerById(id); return Ok(data); } how can we implement fluent validation for request parameter - id?
-1
votes
1 answer

Extremely bizarre Fluent Validation behaviour

Current project: DotNet 4.7 MVC 5 Database-first and generated from a very old Web Forms database (nchar fields and the like… don’t ask why) So I am experiencing extremely bizarre behaviour from Fluent Validation. To wit, Non-Nulled Nullable…
René Kåbis
  • 842
  • 2
  • 9
  • 28
-1
votes
1 answer

How to apply validation to one field if other field is empty using FluentValidation?

I have never heard of FluentValidation until today while I was working on a project, so I have run into an issue. I have this.. RuleFor(x=>x.Company) .NotEmpty() .WithMessage("Company Required"); RuleFor(x => x.FirstName) .NotEmpty() …
Chris
  • 2,953
  • 10
  • 48
  • 118
-2
votes
1 answer

.net core build errors after Visual Studio update

I have updated Visual Studio to 16.10.1 version, and my once fully functioning project is now showing build errors, mainly relating to fluentValidation and JwtBearer. Any advice how to resolve this?
-2
votes
1 answer

How can I make two different validation to the same class C#

I need to make two different validations to the same class in a C# project using fluent validation, how can I do it in a unique validation. For example: I have the Example class called ExampleDTO.cs and also I have the ExampleDTOValidator.cs, so I…
-2
votes
2 answers

How to use FluentValidation in a generic way with DI in MVC controllers

I implemented fluent validation rules. I am sending a request to my controller api endpoint via angular request in json format. When I receive data and model parameter is populated I want to use fluent validation to validate sent data. …
sensei
  • 7,044
  • 10
  • 57
  • 125
1 2 3
95
96