Otis wrote:
Validators work solely for the entities they're located in, and related entities aren't owned by the entities referencing them (e.g. Customer doesn't own its Order entities, so by design it's not Customer's validator's job to validate Orders added. )
I agree it's not the customer's validators job to validate if an order is correct but I would say that it's the customer's validators job to verify if this particular order is allowed to be added to this customer.
Imagine there is inheritance and we have:
Order > VipOrder
Order > TopSecretOrder
Why shouldn't the customer validator be able to throw an exception if a TopSecretOrder is added to an ordinary customer?
Or think of it the other way around. A customer has a flag "customer status" related to another lookup table.
Customer.StatusTypeID = 5; I can check it
Customer.StatusType = PriorityStatusTypeEnity; I can't check it
Which is inconsistent. So I would think it would be helpful if the solution you suggested would be part of the overall framework. People don't have to use it but it's good if the option is there.
Thanks for considering it,
Patrick