Compartir a través de


MigrationBuilder.AddForeignKey Método

Definición

Sobrecargas

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

Crea un AddForeignKeyOperation objeto para agregar una nueva clave externa a una tabla.

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

Crea un AddForeignKeyOperation objeto para agregar una nueva clave externa compuesta (varias columnas) a una tabla.

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

Crea un AddForeignKeyOperation objeto para agregar una nueva clave externa a una tabla.

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)

Parámetros

name
String

Nombre de la restricción de clave externa.

table
String

Tabla que contiene la clave externa.

column
String

Columna restringida.

principalTable
String

Tabla a la que está restringida la clave externa.

schema
String

Esquema que contiene la tabla o null si se debe usar el esquema predeterminado.

principalSchema
String

Esquema que contiene la tabla principal o null si se debe usar el esquema predeterminado.

principalColumn
String

Columna a la que está restringida la columna de clave externa o null para restringirla a la columna de clave principal.

onUpdate
ReferentialAction

Acción que se va a realizar en las actualizaciones.

onDelete
ReferentialAction

Acción que se va a realizar en las eliminaciones.

Devoluciones

Generador para permitir que las anotaciones se agreguen a la operación.

Comentarios

Consulte Migraciones de bases de datos para obtener más información y ejemplos.

Se aplica a

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

Crea un AddForeignKeyOperation objeto para agregar una nueva clave externa compuesta (varias columnas) a una tabla.

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)

Parámetros

name
String

Nombre de la restricción de clave externa.

table
String

Tabla que contiene la clave externa.

columns
String[]

Lista ordenada de columnas restringidas.

principalTable
String

Tabla a la que está restringida la clave externa.

schema
String

Esquema que contiene la tabla o null si se debe usar el esquema predeterminado.

principalSchema
String

Esquema que contiene la tabla principal o null si se debe usar el esquema predeterminado.

principalColumns
String[]

Columnas a las que están restringidas las columnas de clave externa o null para restringirlas a las columnas de clave principal.

onUpdate
ReferentialAction

Acción que se va a realizar en las actualizaciones.

onDelete
ReferentialAction

Acción que se va a realizar en las eliminaciones.

Devoluciones

Generador para permitir que las anotaciones se agreguen a la operación.

Comentarios

Consulte Migraciones de bases de datos para obtener más información y ejemplos.

Se aplica a