Add ValidateInstance.By(Func<T, bool> isValidDelegate) overload

Description

Should be really easy to add it

Environment

None

Activity

Show:

Fabio Maulo December 6, 2010 at 4:18 AM

Yes,
The parameter "c" is IConstraintValidatorContext

Gian Marco Gherardi December 5, 2010 at 11:50 PM

Hi, looking at my code, i see that i use many of this validations:

ValidateInstance.By((x, c) => AssertThatAssociationHasMaxTwoSides).WithMessage("an association can have two sides at most.");
ValidateInstance.By((x, c) => AssertThatBidirectionalAssociationHasConsistentTypes).WithMessage("the 2 sides of an association must have consistent types.");
ValidateInstance.By((x, c) => AssertThatBidirectionalAssociationHasOneInverseSide).WithMessage("a bidirectional association must have one inverse side.");
ValidateInstance.By((x, c) => AssertThatNameIsUnique).WithMessage("Field name must be unique in containing type.");
ValidateInstance.By((x, c) => AssertThatIdIsUnique).WithMessage("Field id must be unique in containing type.");
ValidateInstance.By((x, c) => AssertThatTypeExists).WithMessage("referenced Type does not exists.");

So i think that the feature i'm requesting is already there.

Fabio Maulo December 5, 2010 at 7:46 AM

Which is the aggregate value ?
In general, where you have invalid values, you have to add messages to the IConstraintValidatorContext

Won't Fix

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created May 19, 2010 at 7:16 AM
Updated December 6, 2010 at 4:18 AM
Resolved December 5, 2010 at 7:47 AM
Who's Looking?