MutableEntityTypeExtensions.FindForeignKey Method
Definition
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.
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 static Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey FindForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IProperty property, Microsoft.EntityFrameworkCore.Metadata.IKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IEntityType principalEntityType);
static member FindForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType * Microsoft.EntityFrameworkCore.Metadata.IProperty * Microsoft.EntityFrameworkCore.Metadata.IKey * Microsoft.EntityFrameworkCore.Metadata.IEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
<Extension()>
Public Function FindForeignKey (entityType As IMutableEntityType, property As IProperty, principalKey As IKey, principalEntityType As IEntityType) As IMutableForeignKey
Parameters
- entityType
- IMutableEntityType
The entity type.
- property
- IProperty
The property 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
Entity Framework