示例#1
0
        protected virtual bool ShouldGenerateClientSideRules()
        {
            var  ruleSetToGenerateClientSideRules = RuleSetForClientSideMessagesAttribute.GetRuleSetsForClientValidation(ControllerContext.HttpContext);
            bool executeDefaultRule = (ruleSetToGenerateClientSideRules.Contains("default", StringComparer.OrdinalIgnoreCase) && string.IsNullOrEmpty(Rule.RuleSet));

            return(ruleSetToGenerateClientSideRules.Contains(Rule.RuleSet) || executeDefaultRule);
        }
示例#2
0
        protected virtual bool ShouldGenerateClientSideRules()
        {
            var  ruleSetToGenerateClientSideRules = RuleSetForClientSideMessagesAttribute.GetRuleSetsForClientValidation(ControllerContext.HttpContext);
            bool executeDefaultRule = (ruleSetToGenerateClientSideRules.Contains("default", StringComparer.OrdinalIgnoreCase) &&
                                       (Rule.RuleSets.Length == 0 || Rule.RuleSets.Contains("default", StringComparer.OrdinalIgnoreCase)));

            return(ruleSetToGenerateClientSideRules.Intersect(Rule.RuleSets, StringComparer.OrdinalIgnoreCase).Any() || executeDefaultRule);
        }
示例#3
0
        protected virtual bool ShouldGenerateClientSideRules()
        {
            var ruleSetToGenerateClientSideRules = RuleSetForClientSideMessagesAttribute.GetRuleSetsForClientValidation(ControllerContext.HttpContext);

            return(ruleSetToGenerateClientSideRules.Contains(Rule.RuleSet));
        }