Table of Contents

Class RelationalIndexBuilderExtensions

Namespace
Microsoft.EntityFrameworkCore
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

Relational database specific extension methods for Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder.

public static class RelationalIndexBuilderExtensions
Inheritance
RelationalIndexBuilderExtensions
Inherited Members

Remarks

See Indexes for more information and examples.

Methods

CanSetDatabaseName(IConventionIndexBuilder, string?, bool)

Returns a value indicating whether the given name can be set for the index.

public static bool CanSetDatabaseName(this IConventionIndexBuilder indexBuilder, string? name, bool fromDataAnnotation = false)

Parameters

indexBuilder IConventionIndexBuilder

The builder for the index being configured.

name string

The name of the index.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given name can be set for the index.

Remarks

See Indexes for more information and examples.

CanSetFilter(IConventionIndexBuilder, string?, bool)

Returns a value indicating whether the given expression can be set as the filter for the index.

public static bool CanSetFilter(this IConventionIndexBuilder indexBuilder, string? sql, bool fromDataAnnotation = false)

Parameters

indexBuilder IConventionIndexBuilder

The builder for the index being configured.

sql string

The filter expression for the index.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given name can be set for the index.

Remarks

See Indexes for more information and examples.

HasDatabaseName(IConventionIndexBuilder, string?, bool)

Configures the name of the index in the database when targeting a relational database.

public static IConventionIndexBuilder? HasDatabaseName(this IConventionIndexBuilder indexBuilder, string? name, bool fromDataAnnotation = false)

Parameters

indexBuilder IConventionIndexBuilder

The builder for the index being configured.

name string

The name of the index.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

The same builder instance if the configuration was applied, null otherwise.

Remarks

See Indexes for more information and examples.

HasDatabaseName(IndexBuilder, string?)

Configures the name of the index in the database when targeting a relational database.

public static IndexBuilder HasDatabaseName(this IndexBuilder indexBuilder, string? name)

Parameters

indexBuilder IndexBuilder

The builder for the index being configured.

name string

The name of the index.

Returns

IndexBuilder

A builder to further configure the index.

Remarks

See Indexes for more information and examples.

HasDatabaseName<TEntity>(IndexBuilder<TEntity>, string?)

Configures the name of the index in the database when targeting a relational database.

public static IndexBuilder<TEntity> HasDatabaseName<TEntity>(this IndexBuilder<TEntity> indexBuilder, string? name)

Parameters

indexBuilder IndexBuilder<TEntity>

The builder for the index being configured.

name string

The name of the index.

Returns

IndexBuilder<TEntity>

A builder to further configure the index.

Type Parameters

TEntity

The entity type being configured.

Remarks

See Indexes for more information and examples.

HasFilter(IConventionIndexBuilder, string?, bool)

Configures the filter expression for the index.

public static IConventionIndexBuilder? HasFilter(this IConventionIndexBuilder indexBuilder, string? sql, bool fromDataAnnotation = false)

Parameters

indexBuilder IConventionIndexBuilder

The builder for the index being configured.

sql string

The filter expression for the index.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionIndexBuilder

The same builder instance if the configuration was applied, null otherwise.

Remarks

See Indexes for more information and examples.

HasFilter(IndexBuilder, string?)

Configures the filter expression for the index.

public static IndexBuilder HasFilter(this IndexBuilder indexBuilder, string? sql)

Parameters

indexBuilder IndexBuilder

The builder for the index being configured.

sql string

The filter expression for the index.

Returns

IndexBuilder

A builder to further configure the index.

Remarks

See Indexes for more information and examples.

HasFilter<TEntity>(IndexBuilder<TEntity>, string?)

Configures the filter expression for the index.

public static IndexBuilder<TEntity> HasFilter<TEntity>(this IndexBuilder<TEntity> indexBuilder, string? sql)

Parameters

indexBuilder IndexBuilder<TEntity>

The builder for the index being configured.

sql string

The filter expression for the index.

Returns

IndexBuilder<TEntity>

A builder to further configure the index.

Type Parameters

TEntity

The entity type being configured.

Remarks

See Indexes for more information and examples.

HasName(IndexBuilder, string?)

Configures the name of the index in the database when targeting a relational database.

[Obsolete("Use HasDatabaseName() instead.")]
public static IndexBuilder HasName(this IndexBuilder indexBuilder, string? name)

Parameters

indexBuilder IndexBuilder

The builder for the index being configured.

name string

The name of the index.

Returns

IndexBuilder

A builder to further configure the index.

Remarks

See Indexes for more information and examples.