Identity constraints - Demonstration

Notice that the key value of the Person item cannot repeat.

Also notice that when you add a person, remove a person or change the first or last name of a person, these values dynamically change in the Main Person field.

 
Team
Team
Reference
Main Person
Person
key
First Name
40
Surname
40
)
Person
key
First Name
40
Surname
40
)
Person
key
First Name
40
Surname
40
)
Person
key
First Name
40
Surname
40
)
Person
key
First Name
40
Surname
40
)
XML output

        
Identity constraints - Description

The identity constraints are a part of the xml schema specification.

The identity constraints defined in xml schema will be ported to the generated MForm control.

The identity constraints consist of two types: keys and key references.

Both the keys and the key references work within the scope of the IdentityConstaint control.

Items, that will have the key constraint are the ones, that are selected with the use of Selector property, relative to the IdentityConstaint's owner item.

Items, that will have the key reference constraint are the ones, that are defined with the use of KeyRef inner property, selected with the use of its Selector property.

The keys

All items with the same key constraint, need to have unique values.

In a situation, when the value of the key is unimportant (it serves only as an id), the AutoFill property of the IdentityConstraint may be set. This way, when a new key item is created, it will be filled with the next possible integer value.

The key references

All items with the key reference constraint, may only have a value from the list of key values.

To make it possible, the item with the key reference constraint should have a ValueHandler that implements the IListControlValueHandler property. In other words, the ValueHandler of the key reference item should accept a list of possible values.

In case the ValueHandler of the key reference item is of different type, it will be overriden with a DropDownListValueHandler

Currently only ListBoxValueHandler and DropDownListValuehandler will function properly for key reference item on keys adding and removing on client side.