EntityTypeBuilder<TEntity>.OwnsMany Method

Definition

Overloads

OwnsMany(String, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany(Type, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany(String, Type, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, String)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

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.

OwnsMany<TRelatedEntity>(String)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

OwnsMany<TRelatedEntity>(String, Action<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

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.

OwnsMany(String, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsMany : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsMany (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

navigationName
String

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

buildAction
Action<OwnedNavigationBuilder>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany(Type, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany (Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsMany : Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsMany (ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)

Parameters

ownedType
Type

The entity type that this relationship targets.

navigationName
String

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

buildAction
Action<OwnedNavigationBuilder>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany(String, Type, String, Action<OwnedNavigationBuilder>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany (string ownedTypeName, Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsMany : string * Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsMany (ownedTypeName As String, ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

ownedType
Type

The CLR type of the entity type that this relationship targets.

navigationName
String

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

buildAction
Action<OwnedNavigationBuilder>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsMany : string * System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity))), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

navigationExpression
Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>

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

buildAction
Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, String)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, string navigationName) where TRelatedEntity : class;
override this.OwnsMany : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

navigationName
String

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

Returns

OwnedNavigationBuilder<TEntity,TRelatedEntity>

An object that can be used to configure the owned type and the relationship.

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsMany : string * System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity)))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

navigationExpression
Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>

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

Returns

OwnedNavigationBuilder<TEntity,TRelatedEntity>

An object that can be used to configure the owned type and the relationship.

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

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

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<OwnedNavigationBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsMany : 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 OwnsMany(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

ownedTypeName
String

The name of the entity type that this relationship targets.

navigationName
String

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

buildAction
Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsMany : System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity))), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>

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

buildAction
Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>, Action<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

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.EntityTypeBuilder<TEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsMany : System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity))), buildAction As Action(Of CollectionOwnershipBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>

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

buildAction
Action<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Applies to

OwnsMany<TRelatedEntity>(String)

Configures a relationship where the target entity is owned by (or part of) this entity.

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

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.

Returns

CollectionOwnershipBuilder<TEntity,TRelatedEntity>
OwnedNavigationBuilder<TEntity,TRelatedEntity>

An object that can be used to configure the owned type and the relationship.

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsMany<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,System.Collections.Generic.IEnumerable<TRelatedEntity>?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsMany : System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
override this.OwnsMany : System.Linq.Expressions.Expression<Func<'Entity, seq<'RelatedEntity>>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity)))) As CollectionOwnershipBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function OwnsMany(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TRelatedEntity)))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)

Type Parameters

TRelatedEntity

The entity type that this relationship targets.

Parameters

navigationExpression
Expression<Func<TEntity,IEnumerable<TRelatedEntity>>>

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

Returns

CollectionOwnershipBuilder<TEntity,TRelatedEntity>
OwnedNavigationBuilder<TEntity,TRelatedEntity>

An object that can be used to configure the owned type and the relationship.

Remarks

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.

After calling this method, you should chain a call to WithOwner(String) to fully configure the relationship.

Applies to

OwnsMany<TRelatedEntity>(String, Action<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>)

Configures a relationship where the target entity is owned by (or part of) this entity.

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

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<CollectionOwnershipBuilder<TEntity,TRelatedEntity>>

An action that performs configuration of the owned type and the relationship.

Returns

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

Applies to