I've run into the problem with NHibernate proxy validation using Castle.Validator component. It's looks like validator could not fetch attributes from entity proxy's properties.
I've tried to define validation attributes using Inherited = true while Castle.Validator runner fetch em using following statement:
property.GetCustomAttributes(typeof(IValidatorBuilder), true);
So it should fetch attributes form my entities while they are technically base classes for object under validation (proxy)? Why does it not working? GetCustomAttribute always return empty array.
Attributes are fine because they are truly part of the domain model.
I think I found solution for the problem. I've patched Castle.Validator to do so thought. It's insane, but this code:
property.GetCustomAttributes(true /*inherit*/);
returns empty array, while in my humble opinion fully equivalent code returns attributes:
System.Attribute.GetCustomAttributes(property);
What the @#$% ?