UI Annotation using Business Rules

XAF Team Blog
01 May 2013

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.

image

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:

image

This will not raise exceptions for Warning and Information Rules when Validation occurs, but will change their notification icon accordingly.

Windows

image

Web

image

HOW TO APPLY THIS GREAT FUNCTIONALITY TO YOUR PROJECT?

  1. Download  RuleType.zip and open it in VS.
  2. Copy its only one Controller located in the RuleTypeController.cs and spanned across three modules to your own platform agnostic and platform depended modules (Win/Web).

    image
  3. 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!

Subscribe to XAF feed
Subscribe to community feed

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.