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一起使用的模型中,阴影实体当前不受支持。 因此,影子状态实体类型将仅存在于迁移模型快照等中。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈