MigrationBuilder.AddPrimaryKey 方法

定义

重载

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

生成 , AddPrimaryKeyOperation 以将多列) 主键的新复合 (添加到表中。

AddPrimaryKey(String, String, String, String)

生成以 AddPrimaryKeyOperation 将新的主键添加到表。

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

生成 , AddPrimaryKeyOperation 以将多列) 主键的新复合 (添加到表中。

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)

参数

name
String

主键约束名称。

table
String

将包含主键的表。

columns
String[]

构成主键的列的有序列表。

schema
String

包含表的架构,或使用 null 默认架构。

返回

允许将批注添加到操作的生成器。

注解

有关详细信息和示例 ,请参阅数据库迁移

适用于

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

生成以 AddPrimaryKeyOperation 将新的主键添加到表。

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)

参数

name
String

主键约束名称。

table
String

将包含主键的表。

column
String

构成主键的列。

schema
String

包含表的架构,或使用 null 默认架构。

返回

允许将批注添加到操作的生成器。

注解

有关详细信息和示例 ,请参阅数据库迁移

适用于