ReferenceOwnershipBuilder<TEntity,TRelatedEntity>.OwnsOne Method

Definition

Overloads

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

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)

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>(Expression<Func<TRelatedEntity,TNewRelatedEntity>>, Action<ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>>)

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, Action<ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>>)

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>(Expression<Func<TRelatedEntity,TNewRelatedEntity>>)

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<TRelatedEntity,TNewRelatedEntity> OwnsOne<TNewRelatedEntity> (System.Linq.Expressions.Expression<Func<TRelatedEntity,TNewRelatedEntity>> navigationExpression) where TNewRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'RelatedEntity, 'NewRelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'RelatedEntity, 'NewRelatedEntity (requires 'RelatedEntity : null and 'NewRelatedEntity : null)> (requires 'NewRelatedEntity : null)
Public Overridable Function OwnsOne(Of TNewRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TRelatedEntity, TNewRelatedEntity))) As ReferenceOwnershipBuilder(Of TRelatedEntity, TNewRelatedEntity)

Type Parameters

TNewRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TRelatedEntity,TNewRelatedEntity>>

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

Returns

ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>

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

Applies to

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.

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

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

Applies to

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

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<TEntity,TRelatedEntity> OwnsOne<TNewRelatedEntity> (System.Linq.Expressions.Expression<Func<TRelatedEntity,TNewRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>> buildAction) where TNewRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'RelatedEntity, 'NewRelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'RelatedEntity, 'NewRelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'NewRelatedEntity : null)
Public Overridable Function OwnsOne(Of TNewRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TRelatedEntity, TNewRelatedEntity)), buildAction As Action(Of ReferenceOwnershipBuilder(Of TRelatedEntity, TNewRelatedEntity))) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)

Type Parameters

TNewRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TRelatedEntity,TNewRelatedEntity>>

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

buildAction
Action<ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>>

An action that performs configuration of the relationship.

Returns

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

Applies to

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

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<TEntity,TRelatedEntity> OwnsOne<TNewRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>> buildAction) where TNewRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'RelatedEntity, 'NewRelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'NewRelatedEntity : null)
Public Overridable Function OwnsOne(Of TNewRelatedEntity As Class) (navigationName As String, buildAction As Action(Of ReferenceOwnershipBuilder(Of TRelatedEntity, TNewRelatedEntity))) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)

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.

buildAction
Action<ReferenceOwnershipBuilder<TRelatedEntity,TNewRelatedEntity>>

An action that performs configuration of the relationship.

Returns

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

Applies to