Share via


DbMigration.AddPrimaryKey Method

Definition

Overloads

AddPrimaryKey(String, String, String, Object)

Adds an operation to create a new primary key.

AddPrimaryKey(String, String[], String, Object)

Adds an operation to create a new primary key based on multiple columns.

AddPrimaryKey(String, String, String, Boolean, Object)

Adds an operation to create a new primary key.

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.

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

Adds an operation to create a new primary key based 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.

AddPrimaryKey(String, String, String, Object)

Adds an operation to create a new primary key.

protected internal void AddPrimaryKey (string table, string column, string name = null, object anonymousArguments = null);
member this.AddPrimaryKey : string * string * string * obj -> unit
Protected Friend Sub AddPrimaryKey (table As String, column As String, Optional name As String = null, Optional anonymousArguments As Object = null)

Parameters

table
String

The table that contains the primary key column. Schema name is optional, if no schema is specified then dbo is assumed.

column
String

The primary key column.

name
String

The name of the primary key in the database. If no value is supplied a unique name will be generated.

anonymousArguments
Object

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

Applies to

AddPrimaryKey(String, String[], String, Object)

Adds an operation to create a new primary key based on multiple columns.

protected internal void AddPrimaryKey (string table, string[] columns, string name = null, object anonymousArguments = null);
member this.AddPrimaryKey : string * string[] * string * obj -> unit
Protected Friend Sub AddPrimaryKey (table As String, columns As String(), Optional name As String = null, Optional anonymousArguments As Object = null)

Parameters

table
String

The table that contains the primary key columns. Schema name is optional, if no schema is specified then dbo is assumed.

columns
String[]

The primary key columns.

name
String

The name of the primary key in the database. If no value is supplied a unique name will be generated.

anonymousArguments
Object

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

Applies to

AddPrimaryKey(String, String, String, Boolean, Object)

Adds an operation to create a new primary key.

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.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddPrimaryKey (string table, string column, string name = null, bool clustered = true, object anonymousArguments = null);
member this.AddPrimaryKey : string * string * string * bool * obj -> unit
Protected Friend Sub AddPrimaryKey (table As String, column As String, Optional name As String = null, Optional clustered As Boolean = true, Optional anonymousArguments As Object = null)

Parameters

table
String

The table that contains the primary key column. Schema name is optional, if no schema is specified then dbo is assumed.

column
String

The primary key column.

name
String

The name of the primary key in the database. If no value is supplied a unique name will be generated.

clustered
Boolean

A value indicating whether or not this is a clustered primary key.

anonymousArguments
Object

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

Attributes

Applies to

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

Adds an operation to create a new primary key based 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.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddPrimaryKey (string table, string[] columns, string name = null, bool clustered = true, object anonymousArguments = null);
member this.AddPrimaryKey : string * string[] * string * bool * obj -> unit
Protected Friend Sub AddPrimaryKey (table As String, columns As String(), Optional name As String = null, Optional clustered As Boolean = true, Optional anonymousArguments As Object = null)

Parameters

table
String

The table that contains the primary key columns. Schema name is optional, if no schema is specified then dbo is assumed.

columns
String[]

The primary key columns.

name
String

The name of the primary key in the database. If no value is supplied a unique name will be generated.

clustered
Boolean

A value indicating whether or not this is a clustered primary key.

anonymousArguments
Object

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

Attributes

Applies to