Table of Contents

Class OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.dll

Provides a simple API for configuring a navigation to an owned entity type.

public class OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> : OwnedNavigationBuilder, IInfrastructure<IConventionEntityTypeBuilder> where TOwnerEntity : class where TDependentEntity : class

Type Parameters

TOwnerEntity
TDependentEntity
Inheritance
OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>
Implements
Inherited Members
Extension Methods

Remarks

See Modeling entity types and relationships for more information and examples.

Constructors

OwnedNavigationBuilder(IMutableForeignKey)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public OwnedNavigationBuilder(IMutableForeignKey ownership)

Parameters

ownership IMutableForeignKey

Methods

HasAnnotation(string, object?)

Adds or updates an annotation on the owned entity type. If an annotation with the key specified in annotation already exists its value will be updated.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> HasAnnotation(string annotation, object? value)

Parameters

annotation string

The key of the annotation to be added or updated.

value object

The value to be stored in the annotation.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

The same builder instance so that multiple configuration calls can be chained.

HasChangeTrackingStrategy(ChangeTrackingStrategy)

Configures the ChangeTrackingStrategy to be used for this entity type. This strategy indicates how the context detects changes to properties for an instance of the entity type.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> HasChangeTrackingStrategy(ChangeTrackingStrategy changeTrackingStrategy)

Parameters

changeTrackingStrategy ChangeTrackingStrategy

The change tracking strategy to be used.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

The same builder instance so that multiple configuration calls can be chained.

HasData(IEnumerable<object>)

Configures this entity to have seed data. It is used to generate data motion migrations.

public virtual DataBuilder<TDependentEntity> HasData(IEnumerable<object> data)

Parameters

data IEnumerable<object>

A collection of seed data represented by anonymous types.

Returns

DataBuilder<TDependentEntity>

An object that can be used to configure the model data.

HasData(IEnumerable<TDependentEntity>)

Adds seed data to this entity type. It is used to generate data motion migrations.

public virtual DataBuilder<TDependentEntity> HasData(IEnumerable<TDependentEntity> data)

Parameters

data IEnumerable<TDependentEntity>

A collection of seed data.

Returns

DataBuilder<TDependentEntity>

An object that can be used to configure the model data.

HasData(params object[])

Configures this entity to have seed data. It is used to generate data motion migrations.

public virtual DataBuilder<TDependentEntity> HasData(params object[] data)

Parameters

data object[]

An array of seed data represented by anonymous types.

Returns

DataBuilder<TDependentEntity>

An object that can be used to configure the model data.

HasData(params TDependentEntity[])

Adds seed data to this entity type. It is used to generate data motion migrations.

public virtual DataBuilder<TDependentEntity> HasData(params TDependentEntity[] data)

Parameters

data TDependentEntity[]

An array of seed data.

Returns

DataBuilder<TDependentEntity>

An object that can be used to configure the model data.

HasIndex(Expression<Func<TDependentEntity, object?>>)

Configures an index on the specified properties. If there is an existing index on the given set of properties, then the existing index will be returned for configuration.

public virtual IndexBuilder<TDependentEntity> HasIndex(Expression<Func<TDependentEntity, object?>> indexExpression)

Parameters

indexExpression Expression<Func<TDependentEntity, object>>

A lambda expression representing the property(s) to be included in the index (blog => blog.Url).

If the index is made up of multiple properties then specify an anonymous type including the properties (post => new { post.Title, post.BlogId }).

Returns

IndexBuilder<TDependentEntity>

An object that can be used to configure the index.

HasIndex(params string[])

Configures an index on the specified properties. If there is an existing index on the given set of properties, then the existing index will be returned for configuration.

public virtual IndexBuilder<TDependentEntity> HasIndex(params string[] propertyNames)

Parameters

propertyNames string[]

The names of the properties that make up the index.

Returns

IndexBuilder<TDependentEntity>

An object that can be used to configure the index.

HasKey(Expression<Func<TDependentEntity, object?>>)

Sets the properties that make up the primary key for this owned entity type.

public virtual KeyBuilder<TDependentEntity> HasKey(Expression<Func<TDependentEntity, object?>> keyExpression)

Parameters

keyExpression Expression<Func<TDependentEntity, object>>

A lambda expression representing the primary key property(s) (blog => blog.Url).

If the primary key is made up of multiple properties then specify an anonymous type including the properties (post => new { post.Title, post.BlogId }).

Returns

KeyBuilder<TDependentEntity>

An object that can be used to configure the primary key.

HasKey(params string[])

Sets the properties that make up the primary key for this owned entity type.

public virtual KeyBuilder<TDependentEntity> HasKey(params string[] propertyNames)

Parameters

propertyNames string[]

The names of the properties that make up the primary key.

Returns

KeyBuilder<TDependentEntity>

An object that can be used to configure the primary key.

HasOne<TNewRelatedEntity>(Expression<Func<TDependentEntity, TNewRelatedEntity?>>?)

Configures a relationship where this entity type has a reference that points to a single instance of the other type in the relationship.

public virtual ReferenceNavigationBuilder<TDependentEntity, TNewRelatedEntity> HasOne<TNewRelatedEntity>(Expression<Func<TDependentEntity, TNewRelatedEntity?>>? navigationExpression = null) where TNewRelatedEntity : class

Parameters

navigationExpression Expression<Func<TDependentEntity, TNewRelatedEntity>>

A lambda expression representing the reference navigation property on this entity type that represents the relationship (post => post.Blog). If no property is specified, the relationship will be configured without a navigation property on this end.

Returns

ReferenceNavigationBuilder<TDependentEntity, TNewRelatedEntity>

An object that can be used to configure the relationship.

Type Parameters

TNewRelatedEntity

The entity type that this relationship targets.

Remarks

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithMany(Expression<Func<TRelatedEntity, IEnumerable<TEntity>?>>?) or WithOne(Expression<Func<TRelatedEntity, TEntity?>>?) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

HasOne<TNewRelatedEntity>(string?)

Configures a relationship where this entity type has a reference that points to a single instance of the other type in the relationship.

public virtual ReferenceNavigationBuilder<TDependentEntity, TNewRelatedEntity> HasOne<TNewRelatedEntity>(string? navigationName) where TNewRelatedEntity : class

Parameters

navigationName string

The name of the reference navigation property on this entity type that represents the relationship. If no property is specified, the relationship will be configured without a navigation property on this end.

Returns

ReferenceNavigationBuilder<TDependentEntity, TNewRelatedEntity>

An object that can be used to configure the relationship.

Type Parameters

TNewRelatedEntity

The entity type that this relationship targets.

Remarks

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithMany(string?) or WithOne(string?) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

Ignore(Expression<Func<TDependentEntity, object?>>)

Excludes the given property from the entity type. This method is typically used to remove properties or navigations from the owned entity type that were added by convention.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> Ignore(Expression<Func<TDependentEntity, object?>> propertyExpression)

Parameters

propertyExpression Expression<Func<TDependentEntity, object>>

A lambda expression representing the property to be ignored (blog => blog.Url).

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

Ignore(string)

Excludes the given property from the entity type. This method is typically used to remove properties or navigations from the owned entity type that were added by convention.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> Ignore(string propertyName)

Parameters

propertyName string

The name of the property to be removed from the entity type.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

Navigation<TNavigation>(Expression<Func<TDependentEntity, IEnumerable<TNavigation>?>>)

Returns an object that can be used to configure an existing navigation property from the owned type to its owner. It is an error for the navigation property not to exist.

public virtual NavigationBuilder<TDependentEntity, TNavigation> Navigation<TNavigation>(Expression<Func<TDependentEntity, IEnumerable<TNavigation>?>> navigationExpression) where TNavigation : class

Parameters

navigationExpression Expression<Func<TDependentEntity, IEnumerable<TNavigation>>>

A lambda expression representing the navigation property to be configured ( blog => blog.Posts).

Returns

NavigationBuilder<TDependentEntity, TNavigation>

An object that can be used to configure the navigation property.

Type Parameters

TNavigation

The target entity type.

Navigation<TNavigation>(Expression<Func<TDependentEntity, TNavigation?>>)

Returns an object that can be used to configure an existing navigation property from the owned type to its owner. It is an error for the navigation property not to exist.

public virtual NavigationBuilder<TDependentEntity, TNavigation> Navigation<TNavigation>(Expression<Func<TDependentEntity, TNavigation?>> navigationExpression) where TNavigation : class

Parameters

navigationExpression Expression<Func<TDependentEntity, TNavigation>>

A lambda expression representing the navigation property to be configured ( blog => blog.Posts).

Returns

NavigationBuilder<TDependentEntity, TNavigation>

An object that can be used to configure the navigation property.

Type Parameters

TNavigation

The target entity type.

OwnsMany(string, string, Action<OwnedNavigationBuilder>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany(string ownedTypeName, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

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

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany(string ownedTypeName, Type ownedType, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

OwnsMany(Type, string, Action<OwnedNavigationBuilder>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany(Type ownedType, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>>)

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

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsMany<TNewDependentEntity>(Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>> navigationExpression) where TNewDependentEntity : class

Parameters

navigationExpression Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>>>

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany<TNewDependentEntity>(Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>> navigationExpression, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

navigationExpression Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>>>

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string)

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

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsMany<TNewDependentEntity>(string navigationName) where TNewDependentEntity : class

Parameters

navigationName string

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany<TNewDependentEntity>(string navigationName, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

navigationName string

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string, Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>>)

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

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsMany<TNewDependentEntity>(string ownedTypeName, Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>> navigationExpression) where TNewDependentEntity : class

Parameters

ownedTypeName string

The name of the entity type that this relationship targets.

navigationExpression Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>>>

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string, Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany<TNewDependentEntity>(string ownedTypeName, Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>?>> navigationExpression, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

ownedTypeName string

The name of the entity type that this relationship targets.

navigationExpression Expression<Func<TDependentEntity, IEnumerable<TNewDependentEntity>>>

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string, string)

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

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsMany<TNewDependentEntity>(string ownedTypeName, string navigationName) where TNewDependentEntity : class

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<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsMany<TNewDependentEntity>(string, string, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsMany<TNewDependentEntity>(string ownedTypeName, string navigationName, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

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<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne(string, string, Action<OwnedNavigationBuilder>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne(string ownedTypeName, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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 relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

OwnsOne(string, Type, string, Action<OwnedNavigationBuilder>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne(string ownedTypeName, Type ownedType, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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 relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

OwnsOne(Type, string, Action<OwnedNavigationBuilder>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne(Type ownedType, string navigationName, Action<OwnedNavigationBuilder> buildAction)

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 relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity, TNewDependentEntity?>>)

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.

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity, TNewDependentEntity?>> navigationExpression) where TNewDependentEntity : class

Parameters

navigationExpression Expression<Func<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity, TNewDependentEntity?>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne<TNewDependentEntity>(Expression<Func<TDependentEntity, TNewDependentEntity?>> navigationExpression, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

navigationExpression Expression<Func<TDependentEntity, TNewDependentEntity>>

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

An action that performs configuration of the relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(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.

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsOne<TNewDependentEntity>(string navigationName) where TNewDependentEntity : class

Parameters

navigationName string

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(string, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne<TNewDependentEntity>(string navigationName, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

navigationName string

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

An action that performs configuration of the relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(string, Expression<Func<TDependentEntity, TNewDependentEntity?>>)

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.

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, Expression<Func<TDependentEntity, TNewDependentEntity?>> navigationExpression) where TNewDependentEntity : class

Parameters

ownedTypeName string

The name of the entity type that this relationship targets.

navigationExpression Expression<Func<TDependentEntity, TNewDependentEntity>>

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

Returns

OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(string, Expression<Func<TDependentEntity, TNewDependentEntity?>>, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, Expression<Func<TDependentEntity, TNewDependentEntity?>> navigationExpression, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

Parameters

ownedTypeName string

The name of the entity type that this relationship targets.

navigationExpression Expression<Func<TDependentEntity, TNewDependentEntity>>

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

buildAction Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>

An action that performs configuration of the relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(string, 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.

public virtual OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, string navigationName) where TNewDependentEntity : class

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<TDependentEntity, TNewDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

OwnsOne<TNewDependentEntity>(string, string, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>>)

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.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> OwnsOne<TNewDependentEntity>(string ownedTypeName, string navigationName, Action<OwnedNavigationBuilder<TDependentEntity, TNewDependentEntity>> buildAction) where TNewDependentEntity : class

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<TDependentEntity, TNewDependentEntity>>

An action that performs configuration of the relationship.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

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

Type Parameters

TNewDependentEntity

The entity type that this relationship targets.

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 to fully configure the relationship.

PrimitiveCollection<TProperty>(Expression<Func<TDependentEntity, TProperty>>)

Returns an object that can be used to configure a property of the owned type where that property represents a collection of primitive values, such as strings or integers.

public virtual PrimitiveCollectionBuilder<TProperty> PrimitiveCollection<TProperty>(Expression<Func<TDependentEntity, TProperty>> propertyExpression)

Parameters

propertyExpression Expression<Func<TDependentEntity, TProperty>>

A lambda expression representing the property to be configured ( blog => blog.Url).

Returns

PrimitiveCollectionBuilder<TProperty>

An object that can be used to configure the property.

Type Parameters

TProperty

The type of the property to be configured.

Remarks

When adding a new property, if a property with the same name exists in the entity class then it will be added to the model. If no property exists in the entity class, then a new shadow state property will be added. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

Property<TProperty>(Expression<Func<TDependentEntity, TProperty>>)

Returns an object that can be used to configure a property of the owned entity type. If no property with the given name exists, then a new property will be added.

public virtual PropertyBuilder<TProperty> Property<TProperty>(Expression<Func<TDependentEntity, TProperty>> propertyExpression)

Parameters

propertyExpression Expression<Func<TDependentEntity, TProperty>>

A lambda expression representing the property to be configured ( blog => blog.Url).

Returns

PropertyBuilder<TProperty>

An object that can be used to configure the property.

Type Parameters

TProperty

The type of the property to be configured.

Remarks

When adding a new property, if a property with the same name exists in the entity class then it will be added to the model. If no property exists in the entity class, then a new shadow state property will be added. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

UsePropertyAccessMode(PropertyAccessMode)

Sets the PropertyAccessMode to use for all properties of this entity type.

public virtual OwnedNavigationBuilder<TOwnerEntity, TDependentEntity> UsePropertyAccessMode(PropertyAccessMode propertyAccessMode)

Parameters

propertyAccessMode PropertyAccessMode

The PropertyAccessMode to use for properties of this entity type.

Returns

OwnedNavigationBuilder<TOwnerEntity, TDependentEntity>

The same builder instance so that multiple configuration calls can be chained.

Remarks

By default, the backing field, if one is found by convention or has been specified, is used when new objects are constructed, typically when entities are queried from the database. Properties are used for all other accesses. Calling this method will change that behavior for all properties of this entity type as described in the PropertyAccessMode enum.

Calling this method overrides for all properties of this entity type any access mode that was set on the model.

WithOwner(Expression<Func<TDependentEntity, TOwnerEntity?>>?)

Configures the relationship to the owner.

public virtual OwnershipBuilder<TOwnerEntity, TDependentEntity> WithOwner(Expression<Func<TDependentEntity, TOwnerEntity?>>? referenceExpression)

Parameters

referenceExpression Expression<Func<TDependentEntity, TOwnerEntity>>

A lambda expression representing the reference navigation property pointing to the owner (blog => blog.BlogInfo). If no property is specified, the relationship will be configured without a navigation property pointing to the owner.

Returns

OwnershipBuilder<TOwnerEntity, TDependentEntity>

An object that can be used to configure the relationship.

Remarks

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

WithOwner(string?)

Configures the relationship to the owner.

public virtual OwnershipBuilder<TOwnerEntity, TDependentEntity> WithOwner(string? ownerReference = null)

Parameters

ownerReference string

The name of the reference navigation property pointing to the owner. If null or not specified, there is no navigation property pointing to the owner.

Returns

OwnershipBuilder<TOwnerEntity, TDependentEntity>

An object that can be used to configure the relationship.

Remarks

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.