I figured out that the validators were not resolving from the IOC container...rather than delve into this I took a step back and instead found out why the automatic registration method did not work for me previously.
The reason was I originally had this...
public interface IUserRegistrationValidator : IValidator<UserRegistration>
{
}
public class UserRegistrationValidator : AbstractValidator<UserRegistration>, IUserRegistrationValidator
{ //..etc
And ServiceStack code was tripping up on line shown below for obvious reasons (suggest friendly exception):
public static void RegisterValidator(this Container container, Type validator, ReuseScope scope=ReuseScope.None)
{
var baseType = validator.BaseType;
while (!baseType.IsGenericType) // WOULD FAIL ON THIS LINE HERE
{
baseType = baseType.BaseType;
}
var dtoType = baseType.GetGenericArguments()[0];
var validatorType = typeof(IValidator<>).MakeGenericType(dtoType);
container.RegisterAutoWiredType(validator, validatorType, scope);
}
After getting rid of the pointless interfaces I was playing around with I can use the automatic method of registering validators...such as:
container.RegisterValidators(typeof(UserRegistrationValidator).Assembly);
Which resolves my issues, I am not 100% sure how I would manually register the UserValidator from https://github.com/ServiceStack/ServiceStack/wiki/Validation and have it work as I am still somewhat under impression that the following would not work properly.
container.Register<AbstractValidator<User>>(new UserValidator());
...I am likely wrong of course!