Share via


CollectionOwnershipBuilder<TEntity,TDependentEntity>.OwnsOne Method

Definition

Overloads

OwnsOne<TNewRelatedEntity>(String)

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

OwnsOne<TRelatedEntity>(Expression<Func<TDependentEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

OwnsOne<TRelatedEntity>(Expression<Func<TDependentEntity,TRelatedEntity>>, Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

OwnsOne<TRelatedEntity>(String, Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

OwnsOne<TNewRelatedEntity>(String)

Source:
CollectionOwnershipBuilder%60.cs

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TDependentEntity,TNewRelatedEntity> OwnsOne<TNewRelatedEntity> (string navigationName) where TNewRelatedEntity : class;
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'DependentEntity, 'NewRelatedEntity (requires 'DependentEntity : null and 'NewRelatedEntity : null)> (requires 'NewRelatedEntity : null)
Public Overridable Function OwnsOne(Of TNewRelatedEntity As Class) (navigationName As String) As ReferenceOwnershipBuilder(Of TDependentEntity, TNewRelatedEntity)

Type Parameters

TNewRelatedEntity

The entity type that this relationship targets.

Parameters

navigationName
String

The name of the reference navigation property on this entity type that represents the relationship.

Returns

ReferenceOwnershipBuilder<TDependentEntity,TNewRelatedEntity>

An object that can be used to configure the entity type.

Applies to

OwnsOne<TRelatedEntity>(Expression<Func<TDependentEntity,TRelatedEntity>>)

Source:
CollectionOwnershipBuilder%60.cs

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TDependentEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'DependentEntity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'DependentEntity, 'RelatedEntity (requires 'DependentEntity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TDependentEntity, TRelatedEntity))) As ReferenceOwnershipBuilder(Of TDependentEntity, TRelatedEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TDependentEntity,TRelatedEntity>>

A lambda expression representing the reference navigation property on this entity type that represents the relationship (customer => customer.Address).

Returns

ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>

An object that can be used to configure the entity type.

Applies to

OwnsOne<TRelatedEntity>(Expression<Func<TDependentEntity,TRelatedEntity>>, Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>)

Source:
CollectionOwnershipBuilder%60.cs

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<TEntity,TDependentEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TDependentEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'DependentEntity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'DependentEntity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TDependentEntity, TRelatedEntity)), buildAction As Action(Of ReferenceOwnershipBuilder(Of TDependentEntity, TRelatedEntity))) As CollectionOwnershipBuilder(Of TEntity, TDependentEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TDependentEntity,TRelatedEntity>>

A lambda expression representing the reference navigation property on this entity type that represents the relationship (customer => customer.Address).

buildAction
Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>

An action that performs configuration of the relationship.

Returns

An object that can be used to configure the entity type.

Applies to

OwnsOne<TRelatedEntity>(String, Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>)

Source:
CollectionOwnershipBuilder%60.cs

Configures a relationship where the target entity is owned by (or part of) this entity. The target entity key value is always propagated from the entity it belongs to.

The target entity type for each ownership relationship is treated as a different entity type even if the navigation is of the same type. Configuration of the target entity type isn't applied to the target entity type of other ownership relationships.

Most operations on an owned entity require accessing it through the owner entity using the corresponding navigation.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<TEntity,TDependentEntity> OwnsOne<TRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'DependentEntity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String, buildAction As Action(Of ReferenceOwnershipBuilder(Of TDependentEntity, TRelatedEntity))) As CollectionOwnershipBuilder(Of TEntity, TDependentEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationName
String

The name of the reference navigation property on this entity type that represents the relationship.

buildAction
Action<ReferenceOwnershipBuilder<TDependentEntity,TRelatedEntity>>

An action that performs configuration of the relationship.

Returns

An object that can be used to configure the entity type.

Applies to