Share via


ReferenceNavigationBuilder<TEntity,TRelatedEntity>.WithOne Method

Definition

Overloads

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

Configures this as a one-to-one relationship.

WithOne(String)

Configures this as a one-to-one relationship.

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

Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs

Configures this as a one-to-one relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> WithOne (System.Linq.Expressions.Expression<Func<TRelatedEntity,TEntity>> navigationExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<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.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
Public Overridable Function WithOne (navigationExpression As Expression(Of Func(Of TRelatedEntity, TEntity))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

Parameters

navigationExpression
Expression<Func<TRelatedEntity,TEntity>>

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

Returns

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)

Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs

Configures this as a one-to-one relationship.

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

Parameters

navigationName
String

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

Returns

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