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

New Post: Pure inline validation without validation/DTO classes

Thanks for confirming my conclusion! I fully understand that this is outside the scope. I'll do some experiments in my own fork, without taking into consideration that I'll have to merge it back in :)...

View Article


New Post: Validating single rule if the first rule fails.

Jeremy, I too came to a need to stop before the heavier validations run. I have a few validations on properties which run very fast and then a few validations against my DB which are slow and complex....

View Article


New Post: Best way to apply global/default rules for primitive (string) types

Hi folks, We're wanting to enforce some global rules for string inputs (basically a regex match to prevent malicious input), and then allow the validators to override it on specific fields if needed....

View Article

New Post: Complex Property Validation issues

So I have a model that has a property that is of Type A. Type A has a value and text. I'm using this Type A across many different properties on my model. I have a validator rule such as: RuleFor(u...

View Article

New Post: Complex Property Validation issues

Hi Sunny If you take the Message as a constructor argument for your ValueValidator rather than as a property, then you should be able to use this within the child rule's WithMessage call. Jeremy

View Article


New Post: Best way to apply global/default rules for primitive (string) types

I can't really think of another way to do this without reflecting over all the properties as you suggested. I think this is your best bet for now. Jeremy

View Article

New Post: Best way to apply global/default rules for primitive (string) types

Thanks Jeremy, we ended up deciding this was probably a bad plan anyway - not exactly business validation rules! Was just looking for a nice way to get the AllowHtml/ValidateRequest type behaviour but...

View Article

New Post: Complex Property Validation issues

I tried this as well before posting and that did not work. Since I now have a constructor that takes in a message, I have to provide a default constructor or MVC complains. So here's what I have:...

View Article


New Post: Complex Property Validation issues

Hi If you're using a child validator as part of a SetValidator call, then you should exclude this from the MVC integration (if you're using FV's Validator attribute, then be sure to remove this from...

View Article


New Post: Validating single rule if the first rule fails.

Hi Jeremy, This shortcoming IMO was the biggest barrier when I did POCs for making the decision of whether or not to use FluentValidation library. I ended up not using it due to this reason. It was a...

View Article

New Post: Validating single rule if the first rule fails.

Well, if someone wants to have a go at adding this then pull requests are always welcome...

View Article

New Post: Validating interfaces (for reusability)

is this still the best/only way in FluentMvc4 ? or there's a built-in feature/method for this?

View Article

New Post: Rule GreaterThan and WithMesssage

Hi, I would like to customize error messages for validations using the rule GreaterThan. The property associated with the rule is an id selected from a dropdownlist in an ASP.NET MVC view. However, the...

View Article


New Post: Rule GreaterThan and WithMesssage

Hi It sounds like the GreaterThan rule isn't actually executing. If the property is a non-nullable value type (such as an int) then MVC will look for and try to invoke a Required rule before it will...

View Article

New Post: Rule GreaterThan and WithMesssage

Thanks! It solves the issue:)

View Article


Commented Issue: Equal does not use the Display Attribute [7125]

```c#[Display(Name = "NewPassword", ResourceType = typeof(Labels))][DataType(DataType.Password)]public string NewPassword { get; set; }[Display(Name = "NewPasswordVerification", ResourceType =...

View Article

New Post: Validate total across multiple properties

I have a group of "percentage" properties in my view model. As a simple example:public class ViewModel { public int Percent1 { get; set; } public int Percent2 { get; set; } public int Percent3 { get;...

View Article


New Post: Validate total across multiple properties

Hi Yes, FluentValidation is designed to associate validation rules with a particular property. I'd suggest creating an additional read-only TotalPercentage property on the model which sums the...

View Article

New Post: Using SetCollectionValidator - Overriding/Adding RuleSet

I'm trying to reuse a validator within another validator. The subvalidator doesn't have any rulesets defined but the validator using it does. When I call the validator with a ruleset it will not result...

View Article

New Post: Using SetCollectionValidator - Overriding/Adding RuleSet

Hi The default behaviour is to cascade the ruleset selection to child validators. You can bypass this by writing your own implementation of IValidatorSelector rather than using the default...

View Article
Browsing all 1917 articles
Browse latest View live


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