ReferenceNavigationBuilder<TEntity,TRelatedEntity>.WithOne Method
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.
WithOne(Expression<Func<TRelatedEntity,TEntity>>) |
Configures this as a one-to-one relationship. |
WithOne(String) |
Configures this as a one-to-one relationship. |
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
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 |
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
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 |
Entity Framework feedback
Entity Framework is an open source project. Select a link to provide feedback: