This is great news! As you know I have been wanting this and will put
it to good use. I will let you know how it works out.
Right now though I am unable to compile because I think
"CategoriesList.cs" is not checked in. Could you check this?
--- In xrules@yahoogroups.com, "Waleed K.
Abdulla" <waleed_abdulla@...> wrote:
>
> Hi everyone,
> This is to announce the latest new feature: Rule Categories. The
> updated source code is available at http://dynamicdom.tigris.org/
>
> Rule categories address the requirement for categorizing failed
> rules into errors vs. warnings, but it also allows for a much more
> flexible categorization such as "catastrophic, critical,
recoverable" or
> "user, system" or "General, Financial, UserDetails". etc.
Basically, you
> choose your own categorization system. Here is an example:
>
>
> <xr:ruleset context="/PurchaseOrder">
> <xr:validate test="..." categories="error" />
> <xr:validate test="..." categories="warning" />
> </xr:ruleset>
>
> If the first rule fails, for example, the error report will show the
> error as follows (notice the categories attribute):
>
> <xrr:error context="/PurchaseOrder" categories="error">
> <xrr:message>...</xrr:message>
> <xrr:node path="..." />
> </xrr:error>
>
>
>
>
> You can also categorize a rule under several categories by using a
> space-separated list of categories:
>
> <xr:validate test="..." categories="error financial" />
>
>
>
> Categories are also inherited from parent rulesets. For example:
>
> <xr:ruleset context="/PurchaseOrder" categories="header">
> <xr:validate test="..." categories="error" />
> <xr:validate test="..." categories="warning" />
> </xr:ruleset>
>
>
> Or inherited from several up levels of rulesets:
>
> <xr:ruleset context="/PurchaseOrder/Item" categories="item">
>
> <xr:ruleset context="ItemDetails"
categories="financial">
> <xr:validate test="..." />
> </xr:ruleset>
>
> </xr:ruleset>
>
>
> In this example, although the rule does not have the 'categories'
> attribute, it inherits the "item" and "financial" categories. If
this
> rule fails, the error report will show the error as:
>
> <xrr:error context="ItemDetails" categories="financial item">
> <xrr:message>...</xrr:message>
> <xrr:node path="..." />
> </xrr:error>
>
>
>
> And, in the XRules Object Model you can access the categories using
the
> "Catagories" property of rule classes. Or, use the
"EffectiveCategories"
> property to get the rule categories including all categories
inherited
> from parent rulesets.
>
> // Iterate though the categories of a rule.
> CategoriesList cat = myRule.EffectiveCategories;
> if (cat.Count > 0)
> {
> foreach(string category in cat)
> {
> // Iterate through the categories.
> }
> }
>
>
> Hope you find this feature useful.
>
> Regards,
> Waleed
>