Quantcast
Channel: Fluent Validation for .NET
Browsing all 1917 articles
Browse latest View live

New Post: SetValidator not working

Ah great, indeed, after setting ValidatorOptions.CascadeMode = CascadeMode.StopOnFirstFailure; it works fine! An yet another small question: if I want to create a EmailAddressValidator that I can...

View Article


New Post: SetValidator not working

Or you can change the cascade mode for the individual rule rather than changing it globally. Again, creating an AbstractValidator for a string isn't really a good idea. In this particular case, as the...

View Article


New Post: SetValidator not working

Well, I changed it globally because it seems logical that after first validation error it stops validating (in my case). Concerning the email address validation: this validation of an email address...

View Article

New Post: SetValidator not working

This seems an unusual use for FluentValidation, which is designed for validating properties on objects. But if this is the approach you're using then inheriting AbstractValidator<string> will...

View Article

New Post: SetValidator not working

That's what I thought.. maybe I should create an EmailAddressValidator object with an EmailAddress property, and have it validated like that...  EDIT: I created validators for my commands, which solved...

View Article


New Post: AbstractValidator and PropertyName

I want to create a reusable password validator, which can be called from another validator's rules using SetValidator.   I understand from a previous thread that "while you can technically create...

View Article

New Post: Fluent Validation + Service Layer

Hello, On a MVC 3 site I have the following validator:   public class RoleNewModelValidator : AbstractValidator<RoleNewModel> { public RoleNewModelValidator(IRequestDispatcher dispatcher) {...

View Article

New Post: Fluent Validation + Service Layer

Yes - the problem was that you were injecting a transient service into a singleton validator. This ends up forcing the service to be a singleton as well. Using a lazily-evaluated Func<T> is...

View Article


New Post: Fluent Validation + Service Layer

Thank You Jeremy! Miguel

View Article


New Post: how to validate enum values

how do i validate an enum property contain a valid enum option?

View Article

New Post: AbstractValidator and PropertyName

The recommended approach is to use a custom property validator (check out this page in the docs:...

View Article

New Post: PropertyValidator - Create a BaseValidation class for custom error...

Hello all, I'm trying to do a basic validation using only the IsValid method. Maybe I'm trying to do something that is not possible... The property that I'm trying to validate contains all the...

View Article

New Post: PropertyValidator - Create a BaseValidation class for custom error...

Hi This isn't supported from within the IsValid method - you'd need to override the Validate method instead, from where you can return one or more ValidationFailure objects with their own messages....

View Article


New Post: how to validate enum values

The simplest thing would be to use a Must rule. Simple example: public enum MyEnum { First, Second, Third } public class Foo { public MyEnum SomeProperty { get; set; } } public class FooValidator :...

View Article

New Post: PropertyValidator - Create a BaseValidation class for custom error...

I just found a trick and it seems to be working well.   public BaseValidation(CustomProperty property) : base("{ErrorMessage}") { this.property = property; } And now where the magic happens: protected...

View Article


New Post: The String type was not registered with the validator factory.

When I try to use editor templates in my MVC project for @Html.EditorForModel and I add a template in my EditorTemplate/Object.cshtml like below: @Html.Editor("Title") the " String type was not...

View Article

New Post: Using Fluent Validation in editor templates

When you put the [Required] Attribute on the model using the DataAnotation it sets the IsRequired property inside the ViewData if you create an editor template using the...

View Article


New Post: The String type was not registered with the validator factory.

Are you using a custom validator factory? The factory should always return null if it cannot find a validator for a particular type (and not throw an exception). Make sure your validator factory is set...

View Article

New Post: Using Fluent Validation in editor templates

Hi FluentValidation is only used for declaring validation rules - it does not integrate with MVC's concept of model metadata as it is out of scope for this project. If you wanted the IsRequired...

View Article

Reviewed: 3.2 (jan 11, 2012)

Rated 4 Stars (out of 5) - I keep discovering new uses to use this library. It made my life so much simpler. The only wish I have would be a .Net 3.0/3.5 version (either); We are stuck with a few...

View Article
Browsing all 1917 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>