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.

C#
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> WithOne (System.Linq.Expressions.Expression<Func<TRelatedEntity,TEntity>> navigationExpression);
C#
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> WithOne (System.Linq.Expressions.Expression<Func<TRelatedEntity,TEntity?>>? navigationExpression);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

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.

C#
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> WithOne (string navigationName = default);
C#
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> WithOne (string? navigationName = default);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0