Exemplo n.º 1
0
        public override IEnumerable <ModelClientValidationRule> GetClientValidationRules(
            [NotNull] ClientModelValidationContext context)
        {
            var errorMessage = ((CompareAttributeWrapper)Attribute).FormatErrorMessage(context);
            var clientRule   = new ModelClientValidationEqualToRule(errorMessage,
                                                                    FormatPropertyForClientValidation(Attribute.OtherProperty));

            return(new[] { clientRule });
        }
        public override IEnumerable <ModelClientValidationRule> GetClientValidationRules(
            ClientModelValidationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var errorMessage = GetErrorMessage(context);
            var clientRule   = new ModelClientValidationEqualToRule(errorMessage, "*." + Attribute.OtherProperty);

            return(new[] { clientRule });
        }