/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public static IEnumerable <INavigation> FindNavigationsToInHierarchy( [NotNull] this IForeignKey foreignKey, [NotNull] IEntityType entityType) { if (!foreignKey.DeclaringEntityType.IsAssignableFrom(entityType) && !foreignKey.PrincipalEntityType.IsAssignableFrom(entityType)) { throw new InvalidOperationException(CoreStrings.EntityTypeNotInRelationship( entityType.DisplayName(), foreignKey.DeclaringEntityType.DisplayName(), foreignKey.PrincipalEntityType.DisplayName())); } return(foreignKey.IsIntraHierarchical() ? foreignKey.GetNavigations() : foreignKey.FindNavigations(foreignKey.PrincipalEntityType.IsAssignableFrom(entityType))); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public static IEnumerable <INavigation> FindNavigationsTo([NotNull] this IForeignKey foreignKey, [NotNull] IEntityType entityType) { if (foreignKey.DeclaringEntityType != entityType && foreignKey.PrincipalEntityType != entityType) { throw new InvalidOperationException(CoreStrings.EntityTypeNotInRelationshipStrict( entityType.DisplayName(), foreignKey.DeclaringEntityType.DisplayName(), foreignKey.PrincipalEntityType.DisplayName())); } return(foreignKey.IsSelfReferencing() ? foreignKey.GetNavigations() : foreignKey.FindNavigations(foreignKey.PrincipalEntityType == entityType)); }
public static IEnumerable <INavigation> FindNavigationsTo([NotNull] this IForeignKey foreignKey, [NotNull] IEntityType entityType) { Check.NotNull(foreignKey, nameof(foreignKey)); Check.NotNull(entityType, nameof(entityType)); if ((foreignKey.DeclaringEntityType != entityType) && (foreignKey.PrincipalEntityType != entityType)) { throw new ArgumentException(CoreStrings.EntityTypeNotInRelationshipStrict( entityType.DisplayName(), foreignKey.DeclaringEntityType.DisplayName(), foreignKey.PrincipalEntityType.DisplayName())); } return(foreignKey.IsSelfReferencing() ? foreignKey.GetNavigations() : foreignKey.FindNavigations(foreignKey.PrincipalEntityType == entityType)); }