Table of Contents

Interface IConventionIndex

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

Represents an index on a set of properties.

public interface IConventionIndex : IReadOnlyIndex, IConventionAnnotatable, IReadOnlyAnnotatable
Inherited Members

Remarks

This interface is used during model creation and allows the metadata to be modified. Once the model is built, IIndex represents a read-only view of the same metadata.

See Model building conventions for more information and examples.

Properties

Builder

Gets the builder that can be used to configure this index.

IConventionIndexBuilder Builder { get; }

Property Value

IConventionIndexBuilder

Exceptions

InvalidOperationException

If the index has been removed from the model.

DeclaringEntityType

Gets the entity type the index is defined on. This may be different from the type that Properties are defined on when the index is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

IConventionEntityType DeclaringEntityType { get; }

Property Value

IConventionEntityType

Properties

Gets the properties that this index is defined on.

IReadOnlyList<IConventionProperty> Properties { get; }

Property Value

IReadOnlyList<IConventionProperty>

Methods

GetConfigurationSource()

Returns the configuration source for this index.

ConfigurationSource GetConfigurationSource()

Returns

ConfigurationSource

The configuration source.

GetIsDescendingConfigurationSource()

Returns the configuration source for IsDescending.

ConfigurationSource? GetIsDescendingConfigurationSource()

Returns

ConfigurationSource?

The configuration source for IsDescending.

GetIsUniqueConfigurationSource()

Returns the configuration source for IsUnique.

ConfigurationSource? GetIsUniqueConfigurationSource()

Returns

ConfigurationSource?

The configuration source for IsUnique.

SetIsDescending(IReadOnlyList<bool>?, bool)

Sets the sort order(s) for this index (ascending or descending).

IReadOnlyList<bool>? SetIsDescending(IReadOnlyList<bool>? descending, bool fromDataAnnotation = false)

Parameters

descending IReadOnlyList<bool>

A set of values indicating whether each corresponding index column has descending sort order.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IReadOnlyList<bool>

The configured sort order(s).

SetIsUnique(bool?, bool)

Sets a value indicating whether the values assigned to the index properties are unique.

bool? SetIsUnique(bool? unique, bool fromDataAnnotation = false)

Parameters

unique bool?

A value indicating whether the values assigned to the index properties are unique.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool?

The configured uniqueness.