Share via


MigrationBuilder.AddPrimaryKey Method

Definition

Overloads

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

Builds an AddPrimaryKeyOperation to add a new composite (multi-column) primary key to a table.

AddPrimaryKey(String, String, String, String)

Builds an AddPrimaryKeyOperation to add a new primary key to a table.

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

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds an AddPrimaryKeyOperation to add a new composite (multi-column) primary key to a table.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation> AddPrimaryKey (string name, string table, string[] columns, string schema = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation> AddPrimaryKey (string name, string table, string[] columns, string? schema = default);
abstract member AddPrimaryKey : string * string * string[] * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation>
override this.AddPrimaryKey : string * string * string[] * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation>
Public Overridable Function AddPrimaryKey (name As String, table As String, columns As String(), Optional schema As String = Nothing) As OperationBuilder(Of AddPrimaryKeyOperation)

Parameters

name
String

The primary key constraint name.

table
String

The table that will contain the primary key.

columns
String[]

The ordered list of columns that constitute the primary key.

schema
String

The schema that contains the table, or null to use the default schema.

Returns

A builder to allow annotations to be added to the operation.

Remarks

See Database migrations for more information and examples.

Applies to

AddPrimaryKey(String, String, String, String)

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds an AddPrimaryKeyOperation to add a new primary key to a table.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation> AddPrimaryKey (string name, string table, string column, string schema = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation> AddPrimaryKey (string name, string table, string column, string? schema = default);
abstract member AddPrimaryKey : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation>
override this.AddPrimaryKey : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddPrimaryKeyOperation>
Public Overridable Function AddPrimaryKey (name As String, table As String, column As String, Optional schema As String = Nothing) As OperationBuilder(Of AddPrimaryKeyOperation)

Parameters

name
String

The primary key constraint name.

table
String

The table that will contain the primary key.

column
String

The column that constitutes the primary key.

schema
String

The schema that contains the table, or null to use the default schema.

Returns

A builder to allow annotations to be added to the operation.

Remarks

See Database migrations for more information and examples.

Applies to