Table of Contents

Interface IConventionIndexBuilder

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

Provides a simple API surface for configuring an IConventionIndex from conventions.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IConventionIndexBuilder : IConventionAnnotatableBuilder
Inherited Members

Remarks

See Model building conventions for more information and examples.

Properties

Metadata

Gets the index being configured.

IConventionIndex Metadata { get; }

Property Value

IConventionIndex

Methods

CanSetIsDescending(IReadOnlyList<bool>?, bool)

Returns a value indicating whether this index sort order can be configured from the current configuration source.

bool CanSetIsDescending(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

bool

true if the index uniqueness can be configured.

CanSetIsUnique(bool?, bool)

Returns a value indicating whether this index uniqueness can be configured from the current configuration source.

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

Parameters

unique bool?

A value indicating whether the index is unique.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the index uniqueness can be configured.

HasAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource.

IConventionIndexBuilder? HasAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

An IConventionIndexBuilder to continue configuration if the annotation was set, null otherwise.

HasNoAnnotation(string, bool)

Removes the annotation with the given name from this object.

IConventionIndexBuilder? HasNoAnnotation(string name, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to remove.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

An IConventionIndexBuilder to continue configuration if the annotation was set, null otherwise.

HasNonNullAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource. Removes the annotation if null value is specified.

IConventionIndexBuilder? HasNonNullAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation. null to remove the annotations.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

An IConventionIndexBuilder to continue configuration if the annotation was set or removed, null otherwise.

IsDescending(IReadOnlyList<bool>?, bool)

Configures the sort order(s) for the columns of this index (ascending or descending).

IConventionIndexBuilder? IsDescending(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

IConventionIndexBuilder

The same builder instance if the uniqueness was configured, null otherwise.

IsUnique(bool?, bool)

Configures whether this index is unique (i.e. each set of values must be unique).

IConventionIndexBuilder? IsUnique(bool? unique, bool fromDataAnnotation = false)

Parameters

unique bool?

A value indicating whether the index is unique.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

The same builder instance if the uniqueness was configured, null otherwise.