public async Task <ValidateResult> Validate(BusinessAction action, Dictionary <string, object> originalParameters) { //获取参数信息过滤器 var filter = _originalParametersFilterServiceSelector.Choose(action.OriginalParametersFilterType); Dictionary <string, object> parameters = null; if (filter != null) { //获取过滤后的参数信息 parameters = await filter.Execute(originalParameters); } //获取规则信息,转成xml var doc = XDocument.Parse(action.Rule); var result = await _conditionService.Validate(doc, parameters); //如果需要替换 if (!result.Result && !string.IsNullOrEmpty(action.ErrorReplaceText)) { LoggerHelper.LogInformation(_informationCategory, $"BusinessAction {action.Name} validate fail,detail:{result.Description}"); var lcId = ContextContainer.GetValue <int>(ContextTypes.CurrentUserLcid); TemplateContext templateContext = new TemplateContext(lcId, parameters); result.Description = await _templateService.Convert(action.ErrorReplaceText, templateContext); } return(result); }