Skip to main content
All docs
V24.2
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

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