Sneak peek: collection validation in XAF v2009 vol 2 (eXpressApp Framework)

XAF Team Blog
11 June 2009

Just a very quick look at a new feature in v2009 vol 2 of XAF. This is very early stuff, I hear the beta won't be along before the end of June.

We have added the ability to apply rules to collection properties. For instance, in this screenshot you can see a rule failing that is defined to check against the sum of values over the collection. The values in the field "Sum between 0 and 50" are supposed to add up to 50 at most, but since the sum is actually 60, the rule triggers a validation error.

Here's another example. In the "lowest" of the three stacked windows, you can see a collection of objects with a field called "Item Unique Value". The rule that is applied to the collection checks whether the field values are unique across the entire collection. When the detail view is brought up and the second item is edited to have the same value in that field as the first object, the rule triggers a validation error.

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.
Anonymous
Alain

Just great!.

Can you post the syntax of the RuleAttribute?

Regards

11 June 2009
Boris Bosnjak
Boris Bosnjak

Great stuff!

11 June 2009
Alberto Cortes
Alberto Cortes

Great!, I need it just now! :-)

11 June 2009
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Alain,

For the first demo, the rule I described looks like this in code:

[RuleRange("RuleRangeObject.Collection_RuleRange2", DefaultContexts.Save, 0, 50, TargetPropertyName = "SumBetween0And50", TargetCollectionAggregate = Aggregate.Sum, CustomMessageTemplate = @"The sum of the ""{TargetPropertyName}"" values must be within ""{MinimumValue}"" and ""{MaximumValue}"" range. The current value is ""{AggregatedTargetValue}""")]

The second example is based on a specific rule type, so the attribute just looks like this:

[RuleUniqueValue("UniqueValue1", DefaultContexts.Save, TargetPropertyName = "ItemUniqueValue")]

12 June 2009
E3i Tecnologia Ltda
E3i Tecnologia Ltda

Hi Oliver,

This will not be avaliable for Web, correct? BTW, great stuff...

15 June 2009
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Rodrigo -

Oh, this is absolutely available on the web! Our validation functionality is exactly the same across UI platforms.

16 June 2009
Steven Rasmussen
Steven Rasmussen

Just a suggestion but you may want to put tags on this post (XAF, 2009.2, etc).

2 July 2009
Anonymous
ctodx

We're just about to release v2009.2 and it would be a good idea to have an "accumulator"

20 August 2009

Please login or register to post comments.