/// <summary> /// Adds a new relationship to this entity. /// </summary> /// <param name="entityType"> The entity type to add the foreign key to. </param> /// <param name="property"> The property that the foreign key is defined on. </param> /// <param name="principalKey"> The primary or alternate key that is referenced. </param> /// <param name="principalEntityType"> /// The entity type that the relationship targets. This may be different from the type that <paramref name="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). /// </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> The newly created foreign key. </returns> public static IConventionForeignKey AddForeignKey( [NotNull] this IConventionEntityType entityType, [NotNull] IConventionProperty property, [NotNull] IConventionKey principalKey, [NotNull] IConventionEntityType principalEntityType, bool fromDataAnnotation = false) { Check.NotNull(entityType, nameof(entityType)); return(entityType.AddForeignKey(new[] { property }, principalKey, principalEntityType, fromDataAnnotation)); }