Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

New Post: When Problem.

$
0
0
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 <notifications@codeplex.com> wrote:

From: shapper

Hello,

I have the following:

When(x => x.Mark == MarkType.Annex, () => {

Custom(x => {

HttpPostedFileBase file = x.Files.First();

if (file.ContentLength > 20971520)
new ValidationFailure("Files", "The maximum file size is 20 MB");
return null;

});

});

When I submit the form the x.Files.First() gives an error ...

However, this should not even run because x.Mark is not Annex and the condition is false.

I debugged it and the condition is really false.

Any idea what is wrong?

Thank you,

Miguel


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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