CollectionNavigationBuilder<TEntity,TRelatedEntity>.WithOne Method

Definition

Overloads

WithOne(Expression<Func<TRelatedEntity,TEntity>>)

Configures this as a one-to-many relationship.

WithOne(String)

Configures this as a one-to-many relationship.

WithOne(Expression<Func<TRelatedEntity,TEntity>>)

Configures this as a one-to-many relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> WithOne (System.Linq.Expressions.Expression<Func<TRelatedEntity,TEntity>> navigationExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> WithOne (System.Linq.Expressions.Expression<Func<TRelatedEntity,TEntity?>>? navigationExpression);
override this.WithOne : System.Linq.Expressions.Expression<Func<'RelatedEntity, 'Entity>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
Public Overridable Function WithOne (navigationExpression As Expression(Of Func(Of TRelatedEntity, TEntity))) As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity)

Parameters

navigationExpression
Expression<Func<TRelatedEntity,TEntity>>

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

Returns

ReferenceCollectionBuilder<TEntity,TRelatedEntity>

An object to further 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.

Applies to

WithOne(String)

Configures this as a one-to-many relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> WithOne (string navigationName = default);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> WithOne (string? navigationName = default);
override this.WithOne : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
Public Overridable Function WithOne (Optional navigationName As String = Nothing) As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity)

Parameters

navigationName
String

The name of the reference navigation property on the other end of this relationship. If null, there is no navigation property on the other end of the relationship.

Returns

ReferenceCollectionBuilder<TEntity,TRelatedEntity>

An object to further configure the relationship.

Applies to