MigrationBuilder.AddForeignKey Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
AddForeignKey(String, String, String, String, String, String, String, ReferentialAction, ReferentialAction) |
Compila un oggetto AddForeignKeyOperation per aggiungere una nuova chiave esterna a una tabella. |
AddForeignKey(String, String, String[], String, String, String, String[], ReferentialAction, ReferentialAction) |
Compila un oggetto AddForeignKeyOperation per aggiungere una nuova chiave esterna composita (a più colonne) a una tabella. |
AddForeignKey(String, String, String, String, String, String, String, ReferentialAction, ReferentialAction)
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
Compila un oggetto AddForeignKeyOperation per aggiungere una nuova chiave esterna a una tabella.
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)
Parametri
- name
- String
Nome del vincolo chiave esterna.
- table
- String
Tabella contenente la chiave esterna.
- column
- String
Colonna vincolata.
- principalTable
- String
Tabella a cui è vincolata la chiave esterna.
- schema
- String
Schema contenente la tabella o null
se lo schema predefinito deve essere usato.
- principalSchema
- String
Schema contenente la tabella principale o null
se lo schema predefinito deve essere usato.
- principalColumn
- String
Colonna a cui la colonna chiave esterna è vincolata o null
per limitare la colonna chiave primaria.
- onUpdate
- ReferentialAction
Azione da eseguire sugli aggiornamenti.
- onDelete
- ReferentialAction
Azione da eseguire sulle eliminazioni.
Restituisce
Generatore per consentire l'aggiunta di annotazioni all'operazione.
Commenti
Per altre informazioni ed esempi, vedere Migrazioni di database .
Si applica a
AddForeignKey(String, String, String[], String, String, String, String[], ReferentialAction, ReferentialAction)
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
- Origine:
- MigrationBuilder.cs
Compila un oggetto AddForeignKeyOperation per aggiungere una nuova chiave esterna composita (a più colonne) a una tabella.
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)
Parametri
- name
- String
Nome del vincolo chiave esterna.
- table
- String
Tabella contenente la chiave esterna.
- columns
- String[]
Elenco ordinato di colonne vincolate.
- principalTable
- String
Tabella a cui è vincolata la chiave esterna.
- schema
- String
Schema contenente la tabella o null
se lo schema predefinito deve essere usato.
- principalSchema
- String
Schema contenente la tabella principale o null
se lo schema predefinito deve essere usato.
- principalColumns
- String[]
Colonne a cui le colonne chiave esterna sono vincolate o null
per limitare le colonne chiave primaria.
- onUpdate
- ReferentialAction
Azione da eseguire sugli aggiornamenti.
- onDelete
- ReferentialAction
Azione da eseguire sulle eliminazioni.
Restituisce
Generatore per consentire l'aggiunta di annotazioni all'operazione.
Commenti
Per altre informazioni ed esempi, vedere Migrazioni di database .