IMutableEntityType.AddForeignKey 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
AddForeignKey(IMutableProperty, IMutableKey, IMutableEntityType) |
Adds a new relationship to this entity type. |
AddForeignKey(IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType) |
Adds a new relationship to this entity type. |
AddForeignKey(IMutableProperty, IMutableKey, IMutableEntityType)
Adds a new relationship to this entity type.
public virtual Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey AddForeignKey (Microsoft.EntityFrameworkCore.Metadata.IMutableProperty property, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
abstract member AddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
override this.AddForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableProperty * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
Public Overridable Function AddForeignKey (property As IMutableProperty, principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
Parameters
- 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 newly created foreign key.
Applies to
AddForeignKey(IReadOnlyList<IMutableProperty>, IMutableKey, IMutableEntityType)
Adds a new relationship to this entity type.
public Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey AddForeignKey (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> properties, Microsoft.EntityFrameworkCore.Metadata.IMutableKey principalKey, Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType principalEntityType);
abstract member AddForeignKey : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Metadata.IMutableProperty> * Microsoft.EntityFrameworkCore.Metadata.IMutableKey * Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType -> Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey
Public Function AddForeignKey (properties As IReadOnlyList(Of IMutableProperty), principalKey As IMutableKey, principalEntityType As IMutableEntityType) As IMutableForeignKey
Parameters
- 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 newly created foreign key.
Applies to
Entity Framework