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

New Post: sum collection property value and compare to some other property value

I'm trying to validate that the hours are equal by comparing Projects hours and  TimeEntry hours where dateworked are same date.publicclass TimeSheet {public TimeEntry MondayTime { get; set;}public...

View Article


New Post: sum collection property values and validate is equal to another...

I'd just use linq to sum the values. Something like this maybe? public TimeSheetValidator() { RuleFor(x => x.MondayTime).Must(ValidateHours); // stuck here how to sum project hours and validate that...

View Article


New Post: Using Fluent Validation to Validate String Instances

Hi All,I want to know if it is possible to use Fluent Validation to validate string instances directly rather than validating them through class properties.I want to do something like this...

View Article

New Post: Do validation only for a single property

In addition to this question, I would like to do validation only based on property value.Like: var validator = new ProductValidator(); var result = validator.ValidateSingleProperty(p => p.Code,...

View Article

New Post: Collection Validation & Parent Context

I have read through many of the discussions posted here and am sure this isn't possible but couldn't find a direct answer:Is it possible to somehow get the parent context available to a child...

View Article


New Post: Collection Validation & Parent Context

HiThis currently isn't supported, but should be achievable by writing a custom implementation of the ChildCollectionValidatorAdaptor. If you want to create a work item for this on the issues page, then...

View Article

New Post: Do validation only for a single property

It's already possible to validate a single property like this:varresult=validator.Validate(newPerson(),x=>x.Surname);just make sure you have the FluentValidation namespace imported and this overload...

View Article

New Post: Using Fluent Validation to Validate String Instances

HiThis isn't supported in FluentValidation - the entire purpose of the library is to validate properties on objects (most typically, view-model instances).What you're trying to do is probably possible...

View Article


New Post: Do validation only for a single property

No.After some re-thinking, this does not solve my problem. I want to validate the value ("MyCode") from the Code property form the Product class. The way you explain is that when I do a new Product(),...

View Article


New Post: Collection Validation & Parent Context

I'm a GitHub rookie but I'll try creating a pull request this week to incorporate this into the existing ChildCollectionValidatorAdaptor and extensions... but for now this seems to do the trick (based...

View Article

New Post: Do validation only for a single property

Should be pretty simple to write some something that does this with a bit of reflection. Here's a quick proof-of-conceptpublicstaticclass MyExtensions {publicstatic ValidationResult...

View Article

New Post: FluentValidation StructureMap and DbContext (Entity framework)

Hello, I have bit problem with FluentValidation using together with StructureMap and EntityFramework. My code looks  : // Structure map config : publicclass StructureMapConfig { publicstaticvoid...

View Article

New Post: Collection Validation & Parent Context

After implementing the solution above I've taken a step back a realized it probably doesn't belong in the main source as it depends on having an argument injected into a child validator - this breaks...

View Article


New Post: RuleFoEach Validator?

This discussion talked about getting a parent context into each child validator in a collection:RuleFor(workDay => workDay.WorkItems) .SetCollectionValidator(workDay => new...

View Article

New Post: Do validation only for a single property

I've created the following method :public ValidationResult Validate<TValue>(T instance, Expression<Func<T, object>> propertyExpression, TValue value) { MemberExpression memberExpr;if...

View Article


Created Issue: RuleForEach - Feature Request [7118]

Add a "RuleForEach" method to AbstractValidator that allows validation to be defined for each item in a strongly typed collection but within the scope of the parent. This would be similar to defining...

View Article

Edited Issue: RuleForEach - Feature Request [7118]

Add a "RuleForEach" method to AbstractValidator that allows validation to be defined for each item in a strongly typed collection but within the scope of the parent. This would be similar to defining...

View Article


Edited Issue: RuleForEach - Feature Request [7118]

Add a "RuleForEach" method to AbstractValidator that allows validation to be defined for each item in a strongly typed collection but within the scope of the parent. This would be similar to defining...

View Article

Edited Issue: RuleForEach - Feature Request [7118]

Add a "RuleForEach" method to AbstractValidator that allows validation to be defined for each item in a strongly typed collection but within the scope of the parent. This would be similar to defining...

View Article

New Post: Property validation after everything else valid

I want to check Document uniqueness (via RavenDB), which I've setup using a custom validator, but i don't want it checking that every time I validate, I only want it to check once all other properties...

View Article
Browsing all 1917 articles
Browse latest View live


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