MigrationBuilder.AddUniqueConstraint 方法

定义

重载

AddUniqueConstraint(String, String, String, String)

生成 以 AddUniqueConstraintOperation 向表添加新的唯一约束。

AddUniqueConstraint(String, String, String[], String)

生成 以 AddUniqueConstraintOperation 向表添加新的复合 (多列) 唯一约束。

AddUniqueConstraint(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

生成 以 AddUniqueConstraintOperation 向表添加新的唯一约束。

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

参数

name
String

约束名称。

table
String

将包含约束的表。

column
String

受约束的列。

schema
String

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

返回

一个生成器,允许将批注添加到操作中。

注解

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

适用于

AddUniqueConstraint(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

生成 以 AddUniqueConstraintOperation 向表添加新的复合 (多列) 唯一约束。

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

参数

name
String

约束名称。

table
String

将包含约束的表。

columns
String[]

受约束的列的有序列表。

schema
String

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

返回

一个生成器,允许将批注添加到操作中。

注解

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

适用于