ReferenceReferenceBuilder.HasForeignKey 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
HasForeignKey(String, String[]) |
Configures the property(s) to use as the foreign key for this relationship. |
HasForeignKey(Type, String[]) |
Configures the property(s) to use as the foreign key for this relationship. |
HasForeignKey<TDependentEntity>(String[]) |
Configures the property(s) to use as the foreign key for this relationship. If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class. If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key. |
HasForeignKey(String, String[])
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
Configures the property(s) to use as the foreign key for this relationship.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasForeignKey (string dependentEntityTypeName, params string[] foreignKeyPropertyNames);
abstract member HasForeignKey : string * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
override this.HasForeignKey : string * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
Public Overridable Function HasForeignKey (dependentEntityTypeName As String, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
- dependentEntityTypeName
- String
The name of the entity type that is the dependent in this relationship (the type that has the foreign key properties).
- foreignKeyPropertyNames
- String[]
The name(s) of the foreign key property(s).
Returns
The same builder instance so that multiple configuration calls can be chained.
Remarks
If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.
If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.
Applies to
HasForeignKey(Type, String[])
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
- Source:
- ReferenceReferenceBuilder.cs
Configures the property(s) to use as the foreign key for this relationship.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasForeignKey (Type dependentEntityType, params string[] foreignKeyPropertyNames);
abstract member HasForeignKey : Type * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
override this.HasForeignKey : Type * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
Public Overridable Function HasForeignKey (dependentEntityType As Type, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
- dependentEntityType
- Type
The entity type that is the dependent in this relationship (the type that has the foreign key properties).
- foreignKeyPropertyNames
- String[]
The name(s) of the foreign key property(s).
Returns
The same builder instance so that multiple configuration calls can be chained.
Remarks
If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.
If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.
Applies to
HasForeignKey<TDependentEntity>(String[])
Configures the property(s) to use as the foreign key for this relationship.
If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.
If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasForeignKey<TDependentEntity> (params string[] foreignKeyPropertyNames) where TDependentEntity : class;
abstract member HasForeignKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder (requires 'DependentEntity : null)
override this.HasForeignKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder (requires 'DependentEntity : null)
Public Overridable Function HasForeignKey(Of TDependentEntity As Class) (ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Type Parameters
- TDependentEntity
The entity type that is the dependent in this relationship (the type that has the foreign key properties).
Parameters
- foreignKeyPropertyNames
- String[]
The name(s) of the foreign key property(s).
Returns
The same builder instance so that multiple configuration calls can be chained.
Applies to
Entity Framework