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

New Post: DevExpress 'Mis'-Integration

When I create a default MVC3 project with EF mapping - all validations work OK as per sample: http://fluentvalidation.codeplex.com/wikipage?title=mvc When I create a MVC project using the DevExpress...

View Article


New Post: Apply validator to one item in array

Hello, I created a custom validator to validate the Mime type of an HttpPostedFileBase:   public class FileMimeTypeValidator : PropertyValidator {     private List<String> _types;     public...

View Article


New Post: RuleSet and Action Argument

That was exactly what I was looking for! Thank You Jeremy, Miguel

View Article

New Post: Testing validators and coverage

Hi, I'm finding that for large validators and / or many validators it's easy for a validation rule unit test to slip through the cracks. When testing a validator, I would like to somehow verify that...

View Article

New Post: Apply validator to one item in array

RuleFor(x => x.SomeArrayProperty[0]).SetValidator(new WhateverValidator()).When(x => x.SomeArrayProperty.Length > 0).OverridePropertyName("whatever");

View Article


New Post: Testing validators and coverage

This isn't something that's supported I'm afraid. Depending on the complexity of the validator, there could be huge numbers of positive or negative scenarios to test, so working this out automatically...

View Article

New Post: Testing validators and coverage

Cheers for the quick response Jeremy. You've confirmed what I thought to be the case. Agreed that a strict test-first TDD approach is the best way to write validators, it's just that my concern is from...

View Article

New Post: DevExpress 'Mis'-Integration

I don't have any experience with the DevExpress components myself, so I'm not sure what the cause for this would be. I'd suggest making sure that an instance of the...

View Article


New Post: Apply validator to one item in array

I created a new validator for HttpPostedFileBase[]: public class FileCollectionMimeTypeValidator : PropertyValidator {    private List<String> _types;    public...

View Article


New Post: Apply validator to one item in array

A simple check on the type of the property value should suffice... protected override bool IsValid(PropertyValidatorContext context) { var files = new List<HttpPostedFileBase>();...

View Article

New Post: Apply validator to one item in array

Hi Jeremy, That is a good idea. I am trying to have similar validation behavior for HttpPostedFileBase or HttpPostedFileBase[]. Consider a form with 3 file inputs linked to a model property of type...

View Article

New Post: SetCollectionValidator not firing error?

Hello, After reading Jeremy's blog about FV3 Collection Validation I added the following rule:   RuleFor(x => x.Files).SetCollectionValidator(new FileValidator()).WithMessage("ERROR"); Where...

View Article

New Post: SetCollectionValidator not firing error?

Collection validators are designed for validating the properties of elements within a collection - it will not validate collection elements that are null. Jeremy

View Article


New Post: Validation Rule for overall model

Is there a proper way to create a fluent validation rule for the overall model and not a specific property? What I am doing today is sometimes using a unrelated property that is never displayed for...

View Article

New Post: When Problem.

Hello, I have the following:       When(x => x.Mark == MarkType.Annex, () => {           Custom(x => {             HttpPostedFileBase file = x.Files.First();             if...

View Article


New Post: When Problem.

Hi The current build of FV doesn't support custom rules within top level conditions. I hope to address this in a future release. Jeremy Skinner Sent from my iPhone On 7 Feb 2012, at 19:38, shapper...

View Article

Source code checked in, #53916b00a88d

Support Custom rules within top level When conditions.

View Article


New Post: When Problem.

Fixed in latest commit. Jeremy

View Article

New Post: When Problem.

Great! When do you plan to submit it to to NuGet? I am using FV package on this project so I just wonder. Thank You, Miguel

View Article

New Post: When Problem.

I'll probably do a new release in the next couple of weeks. In the meantime feel free to build from source and let me know f you have any issues. Jeremy Skinner Sent from my iPhone On 8 Feb 2012, at...

View Article
Browsing all 1917 articles
Browse latest View live