IConventionModel.AddOwnedEntityType 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddOwnedEntityType(String, Type, Boolean) |
將擁有的共用類型實體類型新增至模型。 |
AddOwnedEntityType(Type, Boolean) |
將擁有的實體類型新增至模型。 |
AddOwnedEntityType(String, Boolean) |
將預設類型的擁有實體類型新增至模型。 |
AddOwnedEntityType(String, Type, Boolean)
將擁有的共用類型實體類型新增至模型。
public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (string name, Type clrType, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : string * Type * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (name As String, clrType As Type, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType
參數
- name
- String
要加入的機構名稱。
- clrType
- Type
用來表示實體型別實例的 CLR 類別。
- fromDataAnnotation
- Boolean
指出是否已使用資料批註指定組態。
傳回
新的實體類型。
備註
共用類型實體類型是實體類型,可以與模型中的其他類型共用 CLR 類型,但具有唯一的名稱,且一律由名稱識別。
適用於
AddOwnedEntityType(Type, Boolean)
將擁有的實體類型新增至模型。
public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (Type type, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : Type * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (type As Type, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType
參數
- type
- Type
用來表示實體型別實例的 CLR 類別。
- fromDataAnnotation
- Boolean
指出是否已使用資料批註指定組態。
傳回
新的實體類型。
適用於
AddOwnedEntityType(String, Boolean)
將預設類型的擁有實體類型新增至模型。
public Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType? AddOwnedEntityType (string name, bool fromDataAnnotation = false);
abstract member AddOwnedEntityType : string * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType
Public Function AddOwnedEntityType (name As String, Optional fromDataAnnotation As Boolean = false) As IConventionEntityType
參數
- name
- String
要加入的機構名稱。
- fromDataAnnotation
- Boolean
指出是否已使用資料批註指定組態。
傳回
新的實體類型。
備註
在運行 DbContext 時間搭配 使用的模型中,目前不支援陰影實體。 因此,陰影狀態實體類型只會存在於移轉模型快照集等中。