IEntityType.FindForeignKey Method

Definition

Overloads

FindForeignKey(IReadOnlyProperty, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

FindForeignKey(IReadOnlyList<IProperty>, IKey, IEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

FindForeignKey(IReadOnlyList<IReadOnlyProperty>, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

FindForeignKey(IReadOnlyProperty, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

public virtual Microsoft.EntityFrameworkCore.Metadata.IForeignKey? FindForeignKey (Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty property, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
abstract member FindForeignKey : Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
override this.FindForeignKey : Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
Public Overridable Function FindForeignKey (property As IReadOnlyProperty, principalKey As IReadOnlyKey, principalEntityType As IReadOnlyEntityType) As IForeignKey

Parameters

property
IReadOnlyProperty

The property that the foreign key is defined on.

principalKey
IReadOnlyKey

The primary or alternate key that is referenced.

principalEntityType
IReadOnlyEntityType

The entity type that the relationship targets. This may be different from the type that principalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

Returns

The foreign key, or null if none is defined.

Applies to

FindForeignKey(IReadOnlyList<IProperty>, IKey, IEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

public Microsoft.EntityFrameworkCore.Metadata.IForeignKey FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IEntityType principalEntityType);
abstract member FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IProperty> * Microsoft.EntityFrameworkCore.Metadata.IKey * Microsoft.EntityFrameworkCore.Metadata.IEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
Public Function FindForeignKey (properties As IReadOnlyList(Of IProperty), principalKey As IKey, principalEntityType As IEntityType) As IForeignKey

Parameters

properties
IReadOnlyList<IProperty>

The properties that the foreign key is defined on.

principalKey
IKey

The primary or alternate key that is referenced.

principalEntityType
IEntityType

The entity type that the relationship targets. This may be different from the type that principalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

Returns

The foreign key, or null if none is defined.

Applies to

FindForeignKey(IReadOnlyList<IReadOnlyProperty>, IReadOnlyKey, IReadOnlyEntityType)

Gets the foreign key for the given properties that points to a given primary or alternate key. Returns null if no foreign key is found.

public Microsoft.EntityFrameworkCore.Metadata.IForeignKey? FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
abstract member FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IForeignKey
Public Function FindForeignKey (properties As IReadOnlyList(Of IReadOnlyProperty), principalKey As IReadOnlyKey, principalEntityType As IReadOnlyEntityType) As IForeignKey

Parameters

properties
IReadOnlyList<IReadOnlyProperty>

The properties that the foreign key is defined on.

principalKey
IReadOnlyKey

The primary or alternate key that is referenced.

principalEntityType
IReadOnlyEntityType

The entity type that the relationship targets. This may be different from the type that principalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

Returns

The foreign key, or null if none is defined.

Applies to