XAF contains several kinds of modules, one of which is a Validation Module. Validation can be applied to the content of XAF objects when specific rules are applied to the Validation Module. In this post you can find a sample XAF application which extends the Validation to provide support for Warning/Information messages.
Today’s implementation can be used by any Validation Business Rule that exists in the XAF’s Application Model. Displayed below is the default list of these rules, applicable to custom business rules as well.
The sample code extends the Application Model of the IModelRuleBase. By using one more property like the RuleType, the Application Model marks the rule as a warning or as information shown below:
This will not raise exceptions for Warning and Information Rules when Validation occurs, but will change their notification icon accordingly.
Windows
Web
HOW TO APPLY THIS GREAT FUNCTIONALITY TO YOUR PROJECT?
- Download RuleType.zip and open it in VS.
- Copy its only oneController located in the RuleTypeController.cs and spanned across three modules to your own platform agnostic and platform depended modules (Win/Web).
- Hit F5 and profit!
Note: I “borrowed” the code for RuleType support from our community project expandframework I hope that this blog demonstrated once again just how flexible and powerful XAF is when it comes to providing reusable solutions!
↧
UI Annotation using Business Rules
↧