How does one accomplish "model-level" validation as stated in Brad Wilson's post:
Finally, if you want a validation to have access to multiple properties, then make it a model-level validation (so that it gets the entire model as the model parameter, rather than a single individual property value).
From http://forums.asp.net/p/1457591/3650720.aspx
I tried to do the following
[MyCustomValidation("SomeStuff")]
public class MyClass
{
// properties
}
Breakpoints place in the IsValid
override of MyCustomValidation
trigger nothing, the code just continues. Breakpoints in the constructor of MyCustomValidation
work, but nothing after that.
Is this not what model-level validation
refers to?
UPDATE:
dirtygopher's link to http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html shows model validation, the only issue is that the validation attributes are placed on the child properties of the parent class.
I'm looking for a way to place validation-attributes
directly to the class as I demonstrated in my above example.