I have a similar problem as Joe in this thread:
I would like some input on how to move forward.
Suppose you have this:
IEmployee : IPerson, IPhoneNumber
All interfaces are targets of validation, i.e. IPhoneNumber has validation on its property PhoneNumber and IPerson has validation on its property Name and so on.
Let's say you have an employee:
In order to fully validate an IEmployee you would have to make three calls:
Question 1: Is there a better way than calling Validate multiple times to validate an IEmployee?
One possible solution I've been thinking about is to wrap the Validation.Validate<T>(T target) call with my own validation method, MyValidate<T>(T target).
This would first call Validation.Validate(target).
Then check if T has a specific attribute, say ValidateBaseTypes in lack of a better name. If it does then recursively call MyValidate for every base type.