Skip to main content
.NET Framework 4.6.2+

IndexedAttribute.Unique Property

Gets or sets whether the index created by a property or field is a unique one.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public bool Unique { get; set; }

Property Value

Type Description
Boolean

true if the index must be unique (no two persistent objects are permitted to have the same index value); otherwise, false.

Remarks

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;

}
See Also