DependentNavigationPropertyConfiguration<TDependentEntityType>.HasForeignKey<TKey> Method (Expression<Func<TDependentEntityType, TKey>>)
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.
Assembly: EntityFramework (in EntityFramework.dll)
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public CascadableNavigationPropertyConfiguration HasForeignKey<TKey>( Expression<Func<TDependentEntityType, TKey>> foreignKeyExpression )
Parameters
- foreignKeyExpression
-
Type:
System.Linq.Expressions.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.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.CascadableNavigationPropertyConfigurationA configuration object that can be used to further configure the relationship.
Type Parameters
- TKey
The type of the key.