Description:
How can I make a property of an object unique? I noticed that placing [Indexed] above a property makes it an index, but I'm not sure on the syntax required to make it a unique index.
Answer:
The IndexedAttribute has a Unique Boolean property. You should mark your object's property as shown below:
C#public class MyObject : DevExpress.Xpo.XPObject {
...
[DevExpress.Xpo.Indexed(Unique=true)]
public string LastName;
...
}
Visual BasicPublic Class MyObject
Inherits DevExpress.Xpo.XPObject
...
<DevExpress.Xpo.Indexed(Unique:=True)> _
Public LastName As String
...
End Class
See Also:
How to define a multi-field unique index in a persistent object