MutableEntityTypeExtensions.GetOrAddForeignKey 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.
Overloads
GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType) |
Gets an existing relationship, or creates a new one if one is not already defined. |
GetOrAddForeignKey(IMutableEntityType, IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType) |
Gets an existing relationship, or creates a new one if one is not already defined. |
GetOrAddForeignKey(IMutableEntityType, IMutableProperty, IMutableKey, IMutableEntityType)
Gets an existing relationship, or creates a new one if one is not already defined.
public static Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey GetOrAddForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IMutableProperty property, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
static member GetOrAddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType * Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
<Extension()>
Public Function GetOrAddForeignKey (entityType As IMutableEntityType, property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
Parameters
- entityType
- IMutableEntityType
The entity type to get or add the foreign key to.
- property
- IMutableProperty
The property that the foreign key is defined on.
- principalKey
- IMutableKey
The primary or alternate key that is referenced.
- principalEntityType
- IMutableEntityType
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 existing or newly created foreign key.
Applies to
GetOrAddForeignKey(IMutableEntityType, IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)
Gets an existing relationship, or creates a new one if one is not already defined.
public static Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey GetOrAddForeignKey (this Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
static member GetOrAddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
<Extension()>
Public Function GetOrAddForeignKey (entityType As IMutableEntityType, properties As IReadOnlyList(Of IMutableProperty), principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
Parameters
- entityType
- IMutableEntityType
The entity type to get or add the foreign key to.
- properties
- IReadOnlyList<IMutableProperty>
The properties that the foreign key is defined on.
- principalKey
- IMutableKey
The primary or alternate key that is referenced.
- principalEntityType
- IMutableEntityType
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 existing or newly created foreign key.
Applies to
Entity Framework