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

New Post: when condition not working as expected

So your rule will only run when customer.IsPreferredCustomer is true, as specified in the when clause, but your test code sets it to false. Because of this, no rules will run and therefore the...

View Article


New Post: when condition not working as expected

I wanted to invoke the validator for all the values of customer.IsPreferedCustomer (true/false). If it is true then discount should be >0 if it is false then discount should not be >0

View Article


New Post: when condition not working as expected

The rule you've defined above will only execute if IsPreferredCustomer is true. What you want is something like this instead:RuleFor(x =>x.Discount).GreaterThan(0).When(x => x.IsPreferedCustomer...

View Article

New Post: when condition not working as expected

Thanks - It works.

View Article

New Post: checking for multiple values in when condition

RuleFor(customer => customer.Forename).NotEmpty().When(customer => customer.Surname.Equals("FOO")); The above rule only checks if Surname = FOO, how can I write a rule where Surname in...

View Article


New Post: Localized Message Issue

Thank you so much, Jeremy. This works perfect! :)

View Article

New Post: checking for multiple values in when condition

RuleFor(x => x.Forename).NotEmpty().When(x => new[] { "FOO", "BAR", "BAZ" }.Contains(x.Surename));

View Article

New Post: checking for multiple values in when condition

The solution Works. Is there a way to check to see if a property is one of the valid values. For .eg. I am able to use RuleFor(customer => customer.Surname).Matches("(Foo|Bar)") But is there a way...

View Article


New Post: Make nested object required when the rule is added for at least one...

Hi Jeremy, I've similar code, it works but tests doesn't work properly, cause, PropertyName and Member.Name doesn't match. For example PropertyName is "Phone.Number" and Member.Name is "Number" in...

View Article


Source code checked in, #a2a861a3b834fd09bbe1eef8b8cc87168bde7b8f

Compatibility updates for new versions of .net Remove deprecated SetValidator method

View Article

Source code checked in, #5fd7e1de82f60b63e262239bc45b65a5bedd9c10

Revert project file changes for now.

View Article

Source code checked in, #7cc5bff8149f29934af8a76bdcdb1d8942889a1a

Remove broken reference

View Article

Created Unassigned: CascadeMode.StopOnFirstFailure seems to be ignored [7197]

I have a model to validate:```public class BarcodeSearchCriteria{ public string Barcode { get; set; } public BarcodeType BarcodeType { get; set; } // enum}```and a validator doing it:```public class...

View Article


Commented Unassigned: CascadeMode.StopOnFirstFailure seems to be ignored [7197]

I have a model to validate:```public class BarcodeSearchCriteria{ public string Barcode { get; set; } public BarcodeType BarcodeType { get; set; } // enum}```and a validator doing it:```public class...

View Article

Closed Unassigned: CascadeMode.StopOnFirstFailure seems to be ignored [7197]

I have a model to validate:```public class BarcodeSearchCriteria{ public string Barcode { get; set; } public BarcodeType BarcodeType { get; set; } // enum}```and a validator doing it:```public class...

View Article


New Post: ValidationResultHolder - Rule Dependency

Hi Guys, In my project I need to implement a conditional variable to a Rule. Imagine, Rule B can only run if the Rule A does not fail, How do you achieve it today? What I've done is, I created a class...

View Article

Created Unassigned: Nuget support for windows phone 8.1 (windows runtime) [7198]

Can you please add support for nuget installation for windows phone 8.1 (windows runtime)?

View Article


New Post: Add error to collection if items invalid

It would be useful to be able to add an error for a collection property if any of the items fail validation. Fantasy code below:RuleFor(x => x.Guests) .SetCollectionValidator(x => new...

View Article

New Post: Syntax error in documentation example (AbstractValidator.Custom)

? new ValidationFailure("More than 9 pets is not allowed.") should be ? new ValidationFailure("Pets", "More than 9 pets is not allowed.")

View Article

Created Unassigned: Customizing all the error message with error code [7199]

Hats off. It is a great framework. I used it lot of time in my project. For my new project i have to pass error code and and customize all the error message.For example i have to generate error code...

View Article
Browsing all 1917 articles
Browse latest View live


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