다음을 통해 공유


MigrationBuilder.AddForeignKey 메서드

정의

오버로드

AddForeignKey(String, String, String, String, String, String, String, ReferentialAction, ReferentialAction)

AddForeignKeyOperation 를 빌드하여 테이블에 새 외래 키를 추가합니다.

AddForeignKey(String, String, String[], String, String, String, String[], ReferentialAction, ReferentialAction)

AddForeignKeyOperation 를 빌드하여 테이블에 새 복합(다중 열) 외래 키를 추가합니다.

AddForeignKey(String, String, String, String, String, String, String, ReferentialAction, ReferentialAction)

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

AddForeignKeyOperation 를 빌드하여 테이블에 새 외래 키를 추가합니다.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> AddForeignKey (string name, string table, string column, string principalTable, string schema = default, string principalSchema = default, string principalColumn = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> AddForeignKey (string name, string table, string column, string principalTable, string? schema = default, string? principalSchema = default, string? principalColumn = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
abstract member AddForeignKey : string * string * string * string * string * string * string * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
override this.AddForeignKey : string * string * string * string * string * string * string * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
Public Overridable Function AddForeignKey (name As String, table As String, column As String, principalTable As String, Optional schema As String = Nothing, Optional principalSchema As String = Nothing, Optional principalColumn As String = Nothing, Optional onUpdate As ReferentialAction = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Optional onDelete As ReferentialAction = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction) As OperationBuilder(Of AddForeignKeyOperation)

매개 변수

name
String

외래 키 제약 조건 이름입니다.

table
String

외래 키가 포함된 테이블입니다.

column
String

제한된 열입니다.

principalTable
String

외래 키가 제한되는 테이블입니다.

schema
String

테이블이 포함된 스키마이거나 null 기본 스키마를 사용해야 하는 경우 입니다.

principalSchema
String

주 테이블을 포함하는 스키마이거나 null 기본 스키마를 사용해야 하는 경우 입니다.

principalColumn
String

외래 키 열이 제한되거나 null 기본 키 열로 제한할 열입니다.

onUpdate
ReferentialAction

업데이트에 대해 수행할 작업입니다.

onDelete
ReferentialAction

삭제에 대해 수행할 작업입니다.

반환

주석을 작업에 추가할 수 있도록 하는 작성기입니다.

설명

자세한 내용 및 예제는 데이터베이스 마이그레이션 을 참조하세요.

적용 대상

AddForeignKey(String, String, String[], String, String, String, String[], ReferentialAction, ReferentialAction)

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

AddForeignKeyOperation 를 빌드하여 테이블에 새 복합(다중 열) 외래 키를 추가합니다.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> AddForeignKey (string name, string table, string[] columns, string principalTable, string schema = default, string principalSchema = default, string[] principalColumns = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> AddForeignKey (string name, string table, string[] columns, string principalTable, string? schema = default, string? principalSchema = default, string[]? principalColumns = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
abstract member AddForeignKey : string * string * string[] * string * string * string * string[] * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
override this.AddForeignKey : string * string * string[] * string * string * string * string[] * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
Public Overridable Function AddForeignKey (name As String, table As String, columns As String(), principalTable As String, Optional schema As String = Nothing, Optional principalSchema As String = Nothing, Optional principalColumns As String() = Nothing, Optional onUpdate As ReferentialAction = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Optional onDelete As ReferentialAction = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction) As OperationBuilder(Of AddForeignKeyOperation)

매개 변수

name
String

외래 키 제약 조건 이름입니다.

table
String

외래 키가 포함된 테이블입니다.

columns
String[]

제한된 열의 순서가 지정된 목록입니다.

principalTable
String

외래 키가 제한되는 테이블입니다.

schema
String

테이블이 포함된 스키마이거나 null 기본 스키마를 사용해야 하는 경우 입니다.

principalSchema
String

주 테이블을 포함하는 스키마이거나 null 기본 스키마를 사용해야 하는 경우 입니다.

principalColumns
String[]

외래 키 열이 제한 null 되거나 기본 키 열로 제한할 열입니다.

onUpdate
ReferentialAction

업데이트에 대해 수행할 작업입니다.

onDelete
ReferentialAction

삭제에 대해 수행할 작업입니다.

반환

주석을 작업에 추가할 수 있도록 하는 작성기입니다.

설명

자세한 내용 및 예제는 데이터베이스 마이그레이션 을 참조하세요.

적용 대상