When you override a method in a base class, the method in that base class is not explicitly called. You need to do it yourself, so in the Validate
function in RegistrationModel, add a call to the Validate
function in the base UserModel class.
base.Validate(validationContext);
However, as you use yield return
in your validators, that makes the Validate
function an iterator, so it must be iterated through in order for everything to work properly. As per this question, the full solution is to use this code in your RegistrationModel.Validate
function:
foreach (var result in base.Validate(validationContext))
{
yield return result;
}