Back to Devexpress

ValidationModule.EnableRuntimeRuleDiscovery Property

expressappframework-devexpress-dot-expressapp-dot-validation-dot-validationmodule-6450f418.md

latest2.9 KB
Original Source

ValidationModule.EnableRuntimeRuleDiscovery Property

Specifies if the Validation Module generates Rules from custom persistent Sources at runtime.

Namespace : DevExpress.ExpressApp.Validation

Assembly : DevExpress.ExpressApp.Validation.v25.2.dll

NuGet Package : DevExpress.ExpressApp.Validation

Declaration

csharp
[DefaultValue(true)]
public bool EnableRuntimeRuleDiscovery { get; set; }
vb
<DefaultValue(True)>
Public Property EnableRuntimeRuleDiscovery As Boolean

Property Value

TypeDefaultDescription
Booleantrue

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.

csharp
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

IRuleSource

ValidationModule Class

ValidationModule Members

DevExpress.ExpressApp.Validation Namespace