public override IEnumerable <ModelClientValidationRule> GetClientValidationRules()
        {
            IClientValidatable clientValidatable = Attribute as IClientValidatable;

            if (clientValidatable != null)
            {
                return(clientValidatable.GetClientValidationRules(Metadata, ControllerContext));
            }

            return(base.GetClientValidationRules());
        }
        public override IEnumerable<ModelClientValidationRule> GetClientValidationRules()
        {
            IEnumerable<ModelClientValidationRule> results = base.GetClientValidationRules();

            IClientValidatable clientValidatable = Attribute as IClientValidatable;
            if (clientValidatable != null)
            {
                results = results.Concat(clientValidatable.GetClientValidationRules(Metadata, ControllerContext));
            }

            return results;
        }
Beispiel #3
0
        /// <summary>
        /// When implemented in a derived class, returns metadata for client validation.
        /// </summary>
        /// <returns>
        /// The metadata for client validation.
        /// </returns>
        public override IEnumerable <ModelClientValidationRule> GetClientValidationRules()
        {
            // ReSharper disable once SuspiciousTypeConversion.Global
            IClientValidatable supportsClientValidation = m_Validator as IClientValidatable;

            if (supportsClientValidation != null)
            {
                return(supportsClientValidation.GetClientValidationRules(Metadata, ControllerContext));
            }

            return(Enumerable.Empty <ModelClientValidationRule>());
        }