public IndexValidationVisitor(
            ModelStateDictionary modelState,
            IIndexModelValidatorProvider validatorProvider,
            IndexValidatorCache validatorCache,
            IModelMetadataProvider metadataProvider,
            ValidationStateDictionary validationState)
        {
            if (validatorProvider == null)
            {
                throw new ArgumentNullException(nameof(validatorProvider));
            }

            if (validatorCache == null)
            {
                throw new ArgumentNullException(nameof(validatorCache));
            }

            _validatorProvider = validatorProvider;
            _validatorCache    = validatorCache;

            _metadataProvider = metadataProvider;
            _validationState  = validationState;

            _modelState  = modelState;
            _currentPath = new ValidationStack();
        }
        public DefaultIndexObjectValidator(
            IModelMetadataProvider modelMetadataProvider,
            IList <IIndexModelValidatorProvider> validatorProviders)
        {
            if (modelMetadataProvider == null)
            {
                throw new ArgumentNullException(nameof(modelMetadataProvider));
            }

            if (validatorProviders == null)
            {
                throw new ArgumentNullException(nameof(validatorProviders));
            }

            _modelMetadataProvider = modelMetadataProvider;
            _validatorCache        = new IndexValidatorCache();

            _validatorProvider = new CompositeIndexModelValidatorProvider(validatorProviders);
        }