ValidationModule.EnableRuntimeRuleDiscovery Property
Specifies if the Validation Module generates Rules from custom persistent Sources at runtime.
Namespace: DevExpress.ExpressApp.Validation
Assembly: DevExpress.ExpressApp.Validation.v24.2.dll
NuGet Package: DevExpress.ExpressApp.Validation
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | true | true if the Validation Module generates Rules from custom persistent Sources at runtime; otherwise, false. |
Remarks
The Validation Module automatically collects persistent Validation Rule Sources and Rules when you start an application. Persistent Validation Rule Sources and Rules are persistent classes that implement the IRuleSource and IRule interfaces. You can disable automatic collection of persistent Rules and Rule Sources and add custom proxy Rule Sources with different behavior. The following code demonstrates how to do this in the platform-agnostic MySolution.Module project:
File: MySolution.Module\Module.cs.
using DevExpress.ExpressApp.Validation;
// ...
public sealed partial class MySolutionModule : ModuleBase {
//...
public override void Setup(ApplicationModulesManager moduleManager) {
base.Setup(moduleManager);
//...
ValidationModule _validationModule = moduleManager.Modules.FindModule<ValidationModule>();
_validationModule.EnableRuntimeRuleDiscovery = false;
_validationModule.CustomizeApplicationRuntimeRules += ValidationModule_CustomizeApplicationRuntimeRules;
}
private void ValidationModule_CustomizeApplicationRuntimeRules(object sender, CustomizeApplicationRuntimeRulesEventArgs e) {
IRuleSource myRuleSource = new MyRuleSource();
e.RuleSources.Add(myRuleSource);
}
}