Skip to main content
.NET Framework 4.6.2+

ValidationModule.InitializeRuleSet() Method

Initializes the RuleSet object assigned to the DevExpress.Persistent.Validation.Validator.RuleSet property.

Namespace: DevExpress.ExpressApp.Validation

Assembly: DevExpress.ExpressApp.Validation.v24.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 (MySolution.Blazor.Server, MySolution.Win, MySolution.Web) or platform-agnostic (MySolution.Module)project.
  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.

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