/// <summary> /// Validate the query parameters if there are any. /// </summary> /// <param name="validationEvent"></param> /// <returns></returns> public override bool Validate(ValidationEvent validationEvent) { object target = validationEvent.Target; IValidationResults results = validationEvent.Results; bool valid = ValidateInternal(validationEvent); if (!valid) { return(valid); } // Has paremeters? NamedQuery query = (NamedQuery)target; if (string.IsNullOrEmpty(query.Parameters)) { return(true); } IList <NamedQueryParam> queryParams = NamedQueryParamsParser.ParseParams(query.Parameters); NamedQueryParamsValidator validator = new NamedQueryParamsValidator(queryParams); bool isValid = validator.Validate(results).IsValid; return(isValid); }
/// <summary> /// Add query parameters. /// </summary> /// <param name="list"></param> public void AddParameters(List <string> queryParams) { string allParams = string.Empty; foreach (string queryParam in queryParams) { NamedQueryParam param = NamedQueryParamsParser.ParseParams(queryParam)[0]; allParams += param.ToString() + ","; } if (allParams[allParams.Length - 1] == ',') { allParams = allParams.Substring(0, allParams.Length - 1); } this.Parameters = allParams; }