Skip to main content
.NET 6.0+

ValidationModule.InitializeRuleSet() Method

Initializes the RuleSet object assigned to the Validator.RuleSet property.

Namespace: DevExpress.ExpressApp.Validation

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

Declaration

public void InitializeRuleSet()

Remarks

Note

In v23.1 and higher, you do not need to use the InitializeRuleSet method in .NET Core-based applications (both Blazor and WinForms). All required initialization is done automatically.

The Validation Module calls this method on logon and when a user closes the Model Editor at runtime. To initialize validation rules before the main window is displayed and a user logs into the application, follow the steps below:

  1. Override the ModuleBase.Setup method in a platform-specific or platform-agnostic Module.
  2. In this overridden method, handle the XafApplication.SetupComplete event.
  3. In the event handler, access the Validation Module and call the InitializeRuleSet method.

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

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Validation;
// ...
public sealed partial class MySolutionModule : ModuleBase {
    public override void Setup(XafApplication application) {
        base.Setup(application);
        application.SetupComplete += Application_SetupComplete;
    }
    private void Application_SetupComplete(object sender, EventArgs e) {
        ValidationModule module = (ValidationModule)Application.Modules.FindModule(typeof(ValidationModule));
        if(module != null) {
            module.InitializeRuleSet();
        }
    }
    // ...
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the InitializeRuleSet() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also