EntityTypeBuilder<TEntity>.OwnsOne Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OwnsOne(String, String, Action<OwnedNavigationBuilder>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne(Type, String, Action<OwnedNavigationBuilder>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne(String, Type, String, Action<OwnedNavigationBuilder>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,TRelatedEntity>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, String) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, Action<ReferenceOwnershipBuilder<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. |
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>, Action<ReferenceOwnershipBuilder<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. |
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne<TRelatedEntity>(String, Action<OwnedNavigationBuilder<TEntity,TRelatedEntity>>) |
Configures a relationship where the target entity is owned by (or part of) this entity. |
OwnsOne(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> OwnsOne (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
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
OwnsOne(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> OwnsOne (Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
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
OwnsOne(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> OwnsOne (string ownedTypeName, Type ownedType, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> buildAction);
override this.OwnsOne : string * Type * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)>
Public Overridable Function OwnsOne (ownedTypeName As String, ownedType As Type, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder)) As EntityTypeBuilder(Of TEntity)
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
OwnsOne<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> OwnsOne<TRelatedEntity> (string ownedTypeName, string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
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
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,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> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
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,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
OwnsOne<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> OwnsOne<TRelatedEntity> (string ownedTypeName, string navigationName) where TRelatedEntity : class;
override this.OwnsOne : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationName As String) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
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
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
OwnsOne<TRelatedEntity>(String, Expression<Func<TEntity,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> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string ownedTypeName, System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsOne : string * System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (ownedTypeName As String, navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
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,TRelatedEntity>>
A lambda expression representing the reference navigation property on this entity type that represents
the relationship (customer => customer.Address
).
Returns
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
OwnsOne<TRelatedEntity>(String, Action<ReferenceOwnershipBuilder<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> OwnsOne<TRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String, buildAction As Action(Of ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
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<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
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>, Action<ReferenceOwnershipBuilder<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> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
Type Parameters
- TRelatedEntity
The entity type that this relationship targets.
Parameters
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
A lambda expression representing the reference navigation property on this entity type that represents
the relationship (customer => customer.Address
).
- buildAction
- Action<ReferenceOwnershipBuilder<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
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,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> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity)), buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
Type Parameters
- TRelatedEntity
The entity type that this relationship targets.
Parameters
- navigationExpression
- Expression<Func<TEntity,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
OwnsOne<TRelatedEntity>(String)
Configures a relationship where the target entity is owned by (or part of) this entity.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string navigationName) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (string navigationName) where TRelatedEntity : class;
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
override this.OwnsOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
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
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
OwnsOne<TRelatedEntity>(Expression<Func<TEntity,TRelatedEntity>>)
Configures a relationship where the target entity is owned by (or part of) this entity.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity>> navigationExpression) where TRelatedEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity> OwnsOne<TRelatedEntity> (System.Linq.Expressions.Expression<Func<TEntity,TRelatedEntity?>> navigationExpression) where TRelatedEntity : class;
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
override this.OwnsOne : System.Linq.Expressions.Expression<Func<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As ReferenceOwnershipBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationExpression As Expression(Of Func(Of TEntity, TRelatedEntity))) As OwnedNavigationBuilder(Of TEntity, TRelatedEntity)
Type Parameters
- TRelatedEntity
The entity type that this relationship targets.
Parameters
- navigationExpression
- Expression<Func<TEntity,TRelatedEntity>>
A lambda expression representing the reference navigation property on this entity type that represents
the relationship (customer => customer.Address
).
Returns
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
OwnsOne<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> OwnsOne<TRelatedEntity> (string navigationName, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<TEntity,TRelatedEntity>> buildAction) where TRelatedEntity : class;
override this.OwnsOne : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.OwnedNavigationBuilder<'Entity, 'RelatedEntity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'RelatedEntity : null)
Public Overridable Function OwnsOne(Of TRelatedEntity As Class) (navigationName As String, buildAction As Action(Of OwnedNavigationBuilder(Of TEntity, TRelatedEntity))) As EntityTypeBuilder(Of TEntity)
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
Entity Framework