Class CreateIndexBuilder
Provides a fluent builder for defining and creating database indexes as part of migration expressions.
Namespace: Umbraco.Cms.Infrastructure.Migrations.Expressions.Create.Index
Assembly: Umbraco.Infrastructure.dll
Syntax
public class CreateIndexBuilder : ExpressionBuilderBase<CreateIndexExpression>, ICreateIndexForTableBuilder, ICreateIndexOnColumnBuilder, IExecutableBuilder, ICreateIndexColumnOptionsBuilder, ICreateIndexOptionsBuilder, IFluentBuilder
Constructors
View SourceCreateIndexBuilder(CreateIndexExpression)
Initializes a new instance of the CreateIndexBuilder class with the specified create index expression.
Declaration
public CreateIndexBuilder(CreateIndexExpression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateIndexExpression | expression | The CreateIndexExpression that defines the index to be created. |
Properties
View SourceCurrentColumn
Gets or sets the definition of the current column being added to the index.
Declaration
public IndexColumnDefinition? CurrentColumn { get; set; }
Property Value
| Type | Description |
|---|---|
| IndexColumnDefinition |
Methods
View SourceAscending()
Marks the index column to be sorted in ascending order.
Declaration
public ICreateIndexOnColumnBuilder Ascending()
Returns
| Type | Description |
|---|---|
| ICreateIndexOnColumnBuilder | The builder to continue configuring the index column. |
Clustered()
Marks the index as clustered.
Declaration
public ICreateIndexOnColumnBuilder Clustered()
Returns
| Type | Description |
|---|---|
| ICreateIndexOnColumnBuilder | The ICreateIndexOnColumnBuilder instance for further index configuration. |
Descending()
Specifies that the index column should be sorted in descending order.
Declaration
public ICreateIndexOnColumnBuilder Descending()
Returns
| Type | Description |
|---|---|
| ICreateIndexOnColumnBuilder | The builder for configuring the index column. |
Do()
Executes.
Declaration
public void Do()
NonClustered()
Specifies that the index should be created as non-clustered.
Declaration
public ICreateIndexOnColumnBuilder NonClustered()
Returns
| Type | Description |
|---|---|
| ICreateIndexOnColumnBuilder | An ICreateIndexOnColumnBuilder to specify the columns for the index. |
OnColumn(string)
Specifies the index column.
Declaration
public ICreateIndexColumnOptionsBuilder OnColumn(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | columnName |
Returns
| Type | Description |
|---|---|
| ICreateIndexColumnOptionsBuilder |
OnTable(string)
Specifies the table on which the index will be created.
Declaration
public ICreateIndexOnColumnBuilder OnTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | The name of the table. |
Returns
| Type | Description |
|---|---|
| ICreateIndexOnColumnBuilder | An ICreateIndexOnColumnBuilder to define the index columns. |
WithOptions()
Allows further configuration of index options for the current index creation operation.
Declaration
public ICreateIndexOptionsBuilder WithOptions()
Returns
| Type | Description |
|---|---|
| ICreateIndexOptionsBuilder | An ICreateIndexOptionsBuilder to specify index options. |