Table of Contents

Interface IConventionNavigation

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

Represents a navigation property which can be used to navigate a relationship.

public interface IConventionNavigation : IReadOnlyNavigation, IConventionNavigationBase, IReadOnlyNavigationBase, IConventionPropertyBase, IReadOnlyPropertyBase, IConventionAnnotatable, IReadOnlyAnnotatable
Inherited Members
Extension Methods

Remarks

This interface is used during model creation and allows the metadata to be modified. Once the model is built, INavigation represents a read-only view of the same metadata.

See Model building conventions for more information and examples.

Properties

Builder

Gets the builder that can be used to configure this navigation.

IConventionNavigationBuilder Builder { get; }

Property Value

IConventionNavigationBuilder

Exceptions

InvalidOperationException

If the property has been removed from the model.

DeclaringEntityType

Gets the type that this navigation property belongs to.

IConventionEntityType DeclaringEntityType { get; }

Property Value

IConventionEntityType

ForeignKey

Gets the foreign key that defines the relationship this navigation property will navigate.

IConventionForeignKey ForeignKey { get; }

Property Value

IConventionForeignKey

Inverse

Gets the inverse navigation.

IConventionNavigation? Inverse { get; }

Property Value

IConventionNavigation

TargetEntityType

Gets the entity type that this navigation property will hold an instance(s) of.

IConventionEntityType TargetEntityType { get; }

Property Value

IConventionEntityType

Methods

GetInverseConfigurationSource()

Returns the configuration source for Inverse.

ConfigurationSource? GetInverseConfigurationSource()

Returns

ConfigurationSource?

The configuration source for Inverse.

SetInverse(MemberInfo?, bool)

Sets the inverse navigation.

IConventionNavigation? SetInverse(MemberInfo? inverse, bool fromDataAnnotation = false)

Parameters

inverse MemberInfo

The name of the inverse navigation property. Passing null will result in there being no inverse navigation property defined.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionNavigation

The new inverse navigation.

SetInverse(string?, bool)

Sets the inverse navigation.

IConventionNavigation? SetInverse(string? inverseName, bool fromDataAnnotation = false)

Parameters

inverseName string

The name of the inverse navigation property. Passing null will result in there being no inverse navigation property defined.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionNavigation

The new inverse navigation.