ComponentOne Data Source for Entity Framework
C1.LiveLinq.Indexing Namespace / IndexDefinition<T> Class / KeyIsUnique Property

In This Topic
    KeyIsUnique Property
    In This Topic
    Gets a value that indicates whether the key used in this index is a unique key for the collection.
    Public ReadOnly Property KeyIsUnique As System.Boolean
    public System.bool KeyIsUnique {get;}

    Property Value

    true if the key is unique; otherwise, false

    A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique in the IndexCollection.Add method.

    But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the collection. An attempt to modify the collection violating the uniqueness throws an System.InvalidOperationException.

    See Also