CreateTableBuilder<TColumns>.ForeignKey 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ForeignKey(String, Expression<Func<TColumns,Object>>, String, String, String, ReferentialAction, ReferentialAction)
在資料表上設定單一資料行外鍵。
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> ForeignKey (string name, System.Linq.Expressions.Expression<Func<TColumns,object>> column, string principalTable, string principalColumn, string principalSchema = 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> ForeignKey (string name, System.Linq.Expressions.Expression<Func<TColumns,object>> column, string principalTable, string? principalColumn = default, string? principalSchema = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
abstract member ForeignKey : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> * string * string * string * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
override this.ForeignKey : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> * 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 ForeignKey (name As String, column As Expression(Of Func(Of TColumns, Object)), principalTable As String, principalColumn As String, Optional principalSchema 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)
Public Overridable Function ForeignKey (name As String, column As Expression(Of Func(Of TColumns, Object)), principalTable As String, Optional principalColumn As String = Nothing, Optional principalSchema 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
外鍵條件約束名稱。
- column
- Expression<Func<TColumns,Object>>
用於外鍵的資料行。
- principalTable
- String
外鍵受限制的資料表。
- principalColumn
- String
外鍵資料行受限制的資料行。
- principalSchema
- String
包含外鍵受限制之資料表的架構。
- onUpdate
- ReferentialAction
ReferentialAction要用於更新的 。
- onDelete
- ReferentialAction
ReferentialAction要用於刪除的 。
傳回
相同的產生器,讓多個呼叫可以鏈結。
適用於
ForeignKey(String, Expression<Func<TColumns,Object>>, String, String[], String, ReferentialAction, ReferentialAction)
在資料表上設定多資料行 (複合) 外鍵。
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation> ForeignKey (string name, System.Linq.Expressions.Expression<Func<TColumns,object>> columns, string principalTable, string[] principalColumns, string principalSchema = 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> ForeignKey (string name, System.Linq.Expressions.Expression<Func<TColumns,object>> columns, string principalTable, string[]? principalColumns, string? principalSchema = default, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onUpdate = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction, Microsoft.EntityFrameworkCore.Migrations.ReferentialAction onDelete = Microsoft.EntityFrameworkCore.Migrations.ReferentialAction.NoAction);
abstract member ForeignKey : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> * string * string[] * string * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction * Microsoft.EntityFrameworkCore.Migrations.ReferentialAction -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation>
override this.ForeignKey : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> * 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 ForeignKey (name As String, columns As Expression(Of Func(Of TColumns, Object)), principalTable As String, principalColumns As String(), Optional principalSchema 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
外鍵條件約束名稱。
- columns
- Expression<Func<TColumns,Object>>
用於外鍵的資料行。
- principalTable
- String
外鍵受限制的資料表。
- principalColumns
- String[]
外鍵資料行受限制的資料行。
- principalSchema
- String
包含外鍵受限制之資料表的架構。
- onUpdate
- ReferentialAction
ReferentialAction要用於更新的 。
- onDelete
- ReferentialAction
ReferentialAction要用於刪除的 。
傳回
相同的產生器,讓多個呼叫可以鏈結。