Skip to main content
All docs
V24.1
.NET 6.0+

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.1.dll

Declaration

[DefaultValue(true)]
public bool EnableRuntimeRuleDiscovery { get; set; }

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 Module:

File: MySolution.Module\Module.cs(.vb).

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);
    }
}
See Also