Validation (Data Driven)
NuGet Package Details
Package Name
Llamachant.ExpressApp.Validation
XPO
Llamachant.ExpressApp.Validation.Xpo
EF Core
Llamachant.ExpressApp.Validation.EF
Overview
The Validation module allows users to define and manage validation rules at runtime and persist them in the database. This mirrors the capabilities of built-in XAF validation attributes and rules but adds the ability to configure and modify them dynamically through the UI. With this module, users can enforce business logic and data integrity without needing to modify source code, offering a more adaptable and maintainable validation strategy.
TIP:
This module requires the XPO or EF specific module to be added to your solution to function.
Installation
Step 1: Install the Module
Install the relevant ORM-specific module:
Install-Package 'Llamachant.ExpressApp.Validation.Xpo'
Install-Package 'Llamachant.ExpressApp.Validation.EF'
Step 2: Register the Module
Register the relevant ORM-specific module (either Xpo or EF Core):
Module.cs
public override void Setup(XafApplication application) {
base.Setup(application);
// Xpo:
this.RequiredModuleTypes.Add(typeof(LlamachantFrameworkValidationModuleXpo));
// EF Core:
this.RequiredModuleTypes.Add(typeof(LlamachantFrameworkValidationModuleEF));
}
OR
Startup.cs
services.AddXaf(Configuration, builder => {
builder.UseApplication<ExpressAppBlazorApplication>();
builder.Modules
// Xpo:
.AddLlamachantFrameworkValidationModuleXpo();
// EF Core:
.AddLlamachantFrameworkValidationModuleEF();
});
Step 3: Create Appearance Rules
Once the module is installed and registered, you can create new Validation Rules at runtime.
Validation Rule Example