How To Use Unique Constraints

In order to work with the unique constraints you will need to remember the following 3 steps.

1. Add an index for a field you wish to be unique:

c#:

configuration.ObjectClass(typeof(Item)).ObjectField("field").Indexed(true);

VB:

configuration.ObjectClass(GetType(Item)).ObjectField("field").Indexed(true)

[/filter]

2. Configure a unique constraint:


3. Handle unique constraint violation: