xpo-devexpress-dot-xpo-dot-indexedattribute-bfa915a2.md
Gets or sets whether the index created by a property or field is a unique one.
Namespace : DevExpress.Xpo
Assembly : DevExpress.Xpo.v25.2.dll
NuGet Package : DevExpress.Xpo
public bool Unique { get; set; }
Public Property Unique As Boolean
| Type | Description |
|---|---|
| Boolean |
true if the index must be unique (no two persistent objects are permitted to have the same index value); otherwise, false.
|
public class User : XPObject {
[Indexed(Unique = true)]
public int UserId {
get { return fUserId; }
set { SetPropertyValue(nameof(UserId), ref fUserId, value); }
}
int fUserId;
public string UserName {
get { return fUserName; }
set { SetPropertyValue(nameof(UserName), ref fUserName, value); }
}
string fUserName;
}
Public Class User
Inherits XPObject
<Indexed(Unique:=True)> _
Public Property UserId() As Integer
Get
Return fUserId
End Get
Set(ByVal value as Integer)
SetPropertyValue(NameOf(UserId), fUserId, value)
End Set
End Property
Private fUserId As Integer
Public Property UserName() As String
Get
Return fUserName
End Get
Set(ByVal value as String)
SetPropertyValue(NameOf(UserName), fUserName, value)
End Set
End Property
Private fUserName As String
End Class
See Also