Hi!


I have a very simple class

Customer


which has a property

public Orders as List(of Order)



The Order class has two properties


public amount as decimal

public validateAmount as boolean


I want to create a custom attribute that when I validate an Order, I want to do something like this:

Code:
if validateAmount then 

if amount < 10 then 

return new ValidationResult("The amount of this order is too small")
end if
return ValidationResult.Success
end if
The problem I have is, where do I put the custom attribute? On class level or on property level?

I also want the red rectangle around the textbox, but that indicates I must place the custom validator on property level, in the Order class. But there, I have no access to the ValidateAmount property, since the context of the custom validation is the field I place it on, not the object the field is contained in?


Do you have any advice? I feel like I have tried just about any combination possible...

/H