Questions tagged [fluentvalidation-2.0]
39 questions
33
votes
1 answer
Why use fluentvalidation instead of ASP.NET MVC validation
In which circumstances would you choose FluentValidation (FV) over the ASP.NET MVC 3 way?
What are the advantages of FV over MVC? I realise that with the latter we have to write much more code and can litter the code with Data Annotations. Moreover,…

DavidS
- 2,179
- 4
- 26
- 44
19
votes
3 answers
How to validate a string as DateTime using FluentValidation
With FluentValidation, is it possible to validate a string as a parseable DateTime without having to specify a Custom() delegate?
Ideally, I'd like to say something like the EmailAddress function, e.g.:
RuleFor(s =>…

Richard Nienaber
- 10,324
- 6
- 55
- 66
9
votes
5 answers
Any .NET Fluent Argument checking libraries out there?
while looking at Shrinkr's source code (we all review other project's source code to learn, right??? :) ) I noticed the following kewl code .. (abbreviated by me, below)
public virtual Foo Foo
{
get;
set
{
…

Pure.Krome
- 84,693
- 113
- 396
- 647
9
votes
4 answers
Fluent validation with dynamic message
I am trying to building custom validation with dynamic message in fluent validation library.
For example :
public class CreateProcessValidator : AbstractValidator
{
public CreateProcessValidator()
{
RuleFor(x =>…

Mennion
- 2,873
- 3
- 20
- 34
7
votes
1 answer
What is the correct way to register FluentValidation with Simple Injector?
I am able to register FluentValidation AbstractValidators using a FluentValidatorFactory. However, it doesn't feel right, because not all of the IoC container registrations happen during bootstrap / composition root. Instead, the fluent validators…

danludwig
- 46,965
- 25
- 159
- 237
6
votes
4 answers
date validation
how we used data validation on asp.net?
date can't be insert greater than the current date.

user389248
- 61
- 1
6
votes
3 answers
Regular Expression Validator does not validate empty textbox
I would like to validate the textbox for specific text and it must not be blank. But the regular expression validator is not validating if the text box is BLANK. However, it validates if I type something in the text box.
How can I make regular…

TTCG
- 8,805
- 31
- 93
- 141
5
votes
1 answer
Is it possible to stop checking further validations when the first one fails?
Otherwise I always need to check if the value is null before performing any other validations. It's kinda annoying if I have many custom checks that are using Must().
I placed NotEmpty() at the very top of it therefore it already returns false, is…

Stan
- 25,744
- 53
- 164
- 242
4
votes
1 answer
MVC 3 validation messages not shown due ModelState lost after PartialView
I have an MVC 3 project where I have 1 view LoginRegister which contains 2 views with forms for login and pre-register. The problem is after incorrectly completing the pre-register form and using PartialView("LoginRegister", loginRegisterViewModel)…

danmac
- 218
- 2
- 10
3
votes
1 answer
Validation Filter in Azure Function
Problem
I am using fluent validation for model validation and I want it to be done by ValidationFilter in azure function. I already did it in asp.net core app but I don't know how to do it in azure functions
Code
MyValidator
using…

Malik Kashmiri
- 5,741
- 11
- 44
- 80
3
votes
1 answer
FindAsync never comes back however Find works just fine
I am using FluentValidation to validate the objects. I am simply checking checking whether the user exists in database or not. In my case, DbContext.Entity.Find works just fine but DbContext.Entity.FindAsync never returns.
Please refer to the below…

Kashif
- 31
- 1
3
votes
1 answer
Fluent Validation - conditional validation of a potentially null value
I have a number of form fields, such as phone numbers and postal codes, which can be left empty. However, when they are filled out, I want them to conform to strict formatting rules.
I am looking to employ Fluent Validation for this task, but I have…

René Kåbis
- 842
- 2
- 9
- 28
3
votes
2 answers
.Net Object validation
Can I use Validation Application Block, for a high performance program? I mean when I'm getting objects from a stream and I need to validate their values as I parse data coming.
As I understand reflection is involved...
Is there any alternative…

user3072
- 65
- 1
- 7
3
votes
4 answers
a basic issue in implementing validations through properties ? Please guide me
thanks for your attention and time.
I want to implement validations in settter of properties. Here is an issue where your expert help is required please.
I have idea of how I will do validations before setting value. but not getting what to do if…

haansi
- 5,470
- 21
- 63
- 91
2
votes
1 answer
How does FluentValidator determine what display name to use by default?
I'm working with FluentValidator in .NET Core. Everything is working beautifully for the most part, but I notice that when working with complex types, FluentValidator shows the full property name. For example, let's say I have a class named Address…

dhughes
- 295
- 5
- 10