RuntimeEntityType.IReadOnlyEntityType.FindForeignKey Method

Definition

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.

[System.Diagnostics.DebuggerStepThrough]
Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey? IReadOnlyEntityType.FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
[System.Diagnostics.DebuggerStepThrough]
Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey IReadOnlyEntityType.FindForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType principalEntityType);
[<System.Diagnostics.DebuggerStepThrough>]
abstract member Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType.FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey
override this.Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType.FindForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty> * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey * Microsoft.EntityFrameworkCore.Metadata.IReadOnlyEntityType -> Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey
Function FindForeignKey (properties As IReadOnlyList(Of IReadOnlyProperty), principalKey As IReadOnlyKey, principalEntityType As IReadOnlyEntityType) As IReadOnlyForeignKey Implements IReadOnlyEntityType.FindForeignKey

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.

Implements

Attributes

Applies to