EntityTypeBuilder<TEntity>.OwnsOne 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
OwnsOne(String, String, Action<OwnedNavigationBuilder>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<OwnedNavigationBuilder>
执行所拥有类型和关系的配置的操作。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne(Type, String, Action<OwnedNavigationBuilder>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne (Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
参数
- ownedType
- Type
此关系面向的实体类型。
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<OwnedNavigationBuilder>
执行所拥有类型和关系的配置的操作。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne(String, Type, String, Action<OwnedNavigationBuilder>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne (string ownedTypeName, Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- ownedType
- Type
此关系所面向的实体类型的 CLR 类型。
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<OwnedNavigationBuilder>
执行所拥有类型和关系的配置的操作。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系面向的实体类型。
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>
执行所拥有类型和关系的配置的操作。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,TRelatedEntity>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系面向的实体类型。
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
一个 lambda 表达式,表示此实体类型上的引用导航属性,表示 (customer => customer.Address
) 的关系。
- buildAction
- Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>
执行所拥有类型和关系的配置的操作。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, String)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, string navigationName) where TRelatedEntity : class;
override this.OwnsOne : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
类型参数
- TRelatedEntity
此关系面向的实体类型。
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
返回
一个对象,可用于配置拥有的类型和关系。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 WithOwner(String) 的调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- ownedTypeName
- String
此关系所面向的实体类型的名称。
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
一个 lambda 表达式,表示此实体类型上的引用导航属性,表示 (customer => customer.Address
) 的关系。
返回
一个 对象,可用于配置拥有的类型和关系。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航的类型相同。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对拥有实体的大多数操作需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 的 WithOwner(String) 调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, Action<ReferenceOwnershipBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String, buildAction As Action(Of ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<ReferenceOwnershipBuilder<TEntity,TRelatedEntity>>
一个操作,用于对拥有的类型和关系执行配置。
返回
可用于配置实体类型的 对象。
适用于
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>, Action<ReferenceOwnershipBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
一个 lambda 表达式,表示此实体类型上的引用导航属性,表示 () customer => customer.Address
的关系。
- buildAction
- Action<ReferenceOwnershipBuilder<TEntity,TRelatedEntity>>
一个操作,用于对拥有的类型和关系执行配置。
返回
可用于配置实体类型的 对象。
适用于
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
一个 lambda 表达式,表示此实体类型上的引用导航属性,表示 () customer => customer.Address
的关系。
- buildAction
- Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>
一个操作,用于对拥有的类型和关系执行配置。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 的 WithOwner(String) 调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string navigationName) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string navigationName) where TRelatedEntity : class;
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
返回
一个 对象,可用于配置拥有的类型和关系。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 的 WithOwner(String) 调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
一个 lambda 表达式,表示此实体类型上的引用导航属性,表示 () customer => customer.Address
的关系。
返回
一个 对象,可用于配置拥有的类型和关系。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 的 WithOwner(String) 调用以完全配置关系。
适用于
OwnsOne<TRelatedEntity>(String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)
配置目标实体由 (或) 此实体的一部分拥有的关系。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
类型参数
- TRelatedEntity
此关系所面向的实体类型。
参数
- navigationName
- String
此实体类型上表示关系的引用导航属性的名称。
- buildAction
- Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>
一个操作,用于对拥有的类型和关系执行配置。
返回
可用于配置实体类型的 对象。
注解
每个所有权关系的目标实体类型被视为不同的实体类型,即使导航属于同一类型。 目标实体类型的配置不会应用于其他所有权关系的目标实体类型。
对自有实体的大多数操作都需要使用相应的导航通过所有者实体访问它。
调用此方法后,应链接对 的 WithOwner(String) 调用以完全配置关系。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈