Table of Contents

Class ReferenceNavigationBuilder

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.dll

Provides a simple API for configuring a relationship where configuration began on an end of the relationship with a reference that points to an instance of another entity type.

public class ReferenceNavigationBuilder : IInfrastructure<IConventionForeignKeyBuilder>
Inheritance
ReferenceNavigationBuilder
Implements
Derived
Inherited Members
Extension Methods

Remarks

Instances of this class are returned from methods when using the ModelBuilder API and it is not designed to be directly constructed in your application code.

See Modeling entity types and relationships for more information and examples.

Constructors

ReferenceNavigationBuilder(IMutableEntityType, IMutableEntityType, MemberInfo?, IMutableForeignKey)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public ReferenceNavigationBuilder(IMutableEntityType declaringEntityType, IMutableEntityType relatedEntityType, MemberInfo? navigationMemberInfo, IMutableForeignKey foreignKey)

Parameters

declaringEntityType IMutableEntityType
relatedEntityType IMutableEntityType
navigationMemberInfo MemberInfo
foreignKey IMutableForeignKey

ReferenceNavigationBuilder(IMutableEntityType, IMutableEntityType, string?, IMutableForeignKey)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public ReferenceNavigationBuilder(IMutableEntityType declaringEntityType, IMutableEntityType relatedEntityType, string? navigationName, IMutableForeignKey foreignKey)

Parameters

declaringEntityType IMutableEntityType
relatedEntityType IMutableEntityType
navigationName string
foreignKey IMutableForeignKey

Properties

Builder

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual InternalForeignKeyBuilder Builder { get; }

Property Value

InternalForeignKeyBuilder

DeclaringEntityType

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual IMutableEntityType DeclaringEntityType { get; }

Property Value

IMutableEntityType

ReferenceMember

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual MemberInfo? ReferenceMember { get; }

Property Value

MemberInfo

ReferenceName

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual string? ReferenceName { get; }

Property Value

string

RelatedEntityType

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual IMutableEntityType RelatedEntityType { get; }

Property Value

IMutableEntityType

Methods

WithMany(string?)

Configures this as a one-to-many relationship.

public virtual ReferenceCollectionBuilder WithMany(string? collection = null)

Parameters

collection string

The name of the collection 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

ReferenceCollectionBuilder

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.

WithManyBuilder(MemberInfo?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual InternalForeignKeyBuilder WithManyBuilder(MemberInfo? navigationMemberInfo)

Parameters

navigationMemberInfo MemberInfo

Returns

InternalForeignKeyBuilder

WithManyBuilder(string?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual InternalForeignKeyBuilder WithManyBuilder(string? navigationName)

Parameters

navigationName string

Returns

InternalForeignKeyBuilder

WithOne(string?)

Configures this as a one-to-one relationship.

public virtual ReferenceReferenceBuilder WithOne(string? reference = null)

Parameters

reference 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

ReferenceReferenceBuilder

An object that can be used to 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.

WithOneBuilder(MemberInfo?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual InternalForeignKeyBuilder WithOneBuilder(MemberInfo? navigationMemberInfo)

Parameters

navigationMemberInfo MemberInfo

Returns

InternalForeignKeyBuilder

WithOneBuilder(string?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
protected virtual InternalForeignKeyBuilder WithOneBuilder(string? navigationName)

Parameters

navigationName string

Returns

InternalForeignKeyBuilder