DependentNavigationPropertyConfiguration<TDependentEntityType>.HasForeignKey<TKey> 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.
Configures the relationship to use foreign key property(s) that are exposed in the object model. If the foreign key property(s) are not exposed in the object model then use the Map method.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public System.Data.Entity.ModelConfiguration.Configuration.CascadableNavigationPropertyConfiguration HasForeignKey<TKey> (System.Linq.Expressions.Expression<Func<TDependentEntityType,TKey>> foreignKeyExpression);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public System.Data.Entity.ModelConfiguration.Configuration.CascadableNavigationPropertyConfiguration HasForeignKey<TKey> (System.Linq.Expressions.Expression<Func<TDependentEntityType,TKey>> foreignKeyExpression);
member this.HasForeignKey : System.Linq.Expressions.Expression<Func<'DependentEntityType, 'Key>> -> System.Data.Entity.ModelConfiguration.Configuration.CascadableNavigationPropertyConfiguration
Public Function HasForeignKey(Of TKey) (foreignKeyExpression As Expression(Of Func(Of TDependentEntityType, TKey))) As CascadableNavigationPropertyConfiguration
Type Parameters
- TKey
The type of the key.
Parameters
- foreignKeyExpression
- Expression<Func<TDependentEntityType,TKey>>
A lambda expression representing the property to be used as the foreign key. If the foreign key is made up of multiple properties then specify an anonymous type including the properties. When using multiple foreign key properties, the properties must be specified in the same order that the the primary key properties were configured for the principal entity type.
Returns
A configuration object that can be used to further configure the relationship.
- Attributes
Applies to
Entity Framework