DbMigration.CreateIndex Method

 

Adds an operation to create an index on a single column.

Namespace:   System.Data.Entity.Migrations
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_protmethodCreateIndex(String, String, Boolean, String, Boolean, Object)

Adds an operation to create an index on a single column. Entity Framework Migrations APIs are not designed to accept input provided by untrusted sources (such as the end user of an application). If input is accepted from such sources it should be validated before being passed to these APIs to protect against SQL injection attacks etc.

System_CAPS_protmethodCreateIndex(String, String[], Boolean, String, Boolean, Object)

Adds an operation to create an index on multiple columns. Entity Framework Migrations APIs are not designed to accept input provided by untrusted sources (such as the end user of an application). If input is accepted from such sources it should be validated before being passed to these APIs to protect against SQL injection attacks etc.

Return to top

DbMigration.CreateIndex Method (String, String, Boolean, String, Boolean, Object)

Adds an operation to create an index on a single column. Entity Framework Migrations APIs are not designed to accept input provided by untrusted sources (such as the end user of an application). If input is accepted from such sources it should be validated before being passed to these APIs to protect against SQL injection attacks etc.

[SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void CreateIndex(
	string table,
	string column,
	bool unique = false,
	string name = null,
	bool clustered = false,
	object anonymousArguments = null
)

Parameters

table
Type: System.String

The name of the table to create the index on. Schema name is optional, if no schema is specified then dbo is assumed.

column
Type: System.String

The name of the column to create the index on.

unique
Type: System.Boolean

A value indicating if this is a unique index. If no value is supplied a non-unique index will be created.

name
Type: System.String

The name to use for the index in the database. If no value is supplied a unique name will be generated.

clustered
Type: System.Boolean

A value indicating whether or not this is a clustered index.

anonymousArguments
Type: System.Object

The additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.

Return to top

DbMigration.CreateIndex Method (String, String[], Boolean, String, Boolean, Object)

Adds an operation to create an index on multiple columns. Entity Framework Migrations APIs are not designed to accept input provided by untrusted sources (such as the end user of an application). If input is accepted from such sources it should be validated before being passed to these APIs to protect against SQL injection attacks etc.

[SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void CreateIndex(
	string table,
	string[] columns,
	bool unique = false,
	string name = null,
	bool clustered = false,
	object anonymousArguments = null
)

Parameters

table
Type: System.String

The name of the table to create the index on. Schema name is optional, if no schema is specified then dbo is assumed.

columns
Type: System.String[]

The name of the columns to create the index on.

unique
Type: System.Boolean

A value indicating if this is a unique index. If no value is supplied a non-unique index will be created.

name
Type: System.String

The name to use for the index in the database. If no value is supplied a unique name will be generated.

clustered
Type: System.Boolean

A value indicating whether or not this is a clustered index.

anonymousArguments
Type: System.Object

The additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.

Return to top
Show: