partial void OnConfigure(AutoQueryAppHost host, Container container) { host.ScriptContext.ScriptMethods.AddRange(new ScriptMethods[] { new DbScriptsAsync(), new MyValidators(), }); host.Plugins.Add(new ValidationFeature { ConditionErrorCodes = { [ValidationConditions.IsOdd] = "NotOdd", }, ErrorCodeMessages = { ["NotOdd"] = "{PropertyName} must be odd", ["RuleMessage"] = "ErrorCodeMessages for RuleMessage", } }); if (UseDbSource) { container.Register <IValidationSource>(c => new OrmLiteValidationSource(c.Resolve <IDbConnectionFactory>(), host.GetMemoryCacheClient())); } else { container.Register <IValidationSource>(new MemoryValidationSource()); } var validationSource = container.Resolve <IValidationSource>(); validationSource.InitSchema(); validationSource.SaveValidationRulesAsync(new List <ValidationRule> { new ValidationRule { Type = nameof(DynamicValidationRules), Validator = "IsAuthenticated" }, new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.LastName), Validator = "NotNull" }, new ValidationRule { Type = nameof(DynamicValidationRules), Field = nameof(DynamicValidationRules.Age), Validator = "InclusiveBetween(13,100)" }, }); }
partial void OnConfigure(AutoQueryAppHost host, Funq.Container container);