public ObjectAccessExpression(INavigation navigation, Expression accessExpression) { Name = navigation.TargetEntityType.GetContainingPropertyName(); if (Name == null) { throw new InvalidOperationException( CosmosStrings.NavigationPropertyIsNotAnEmbeddedEntity( navigation.DeclaringEntityType.DisplayName(), navigation.Name)); } Navigation = navigation; AccessExpression = accessExpression; }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public ObjectArrayProjectionExpression( [NotNull] INavigation navigation, [NotNull] Expression accessExpression, [CanBeNull] EntityProjectionExpression innerProjection = null) { var targetType = navigation.TargetEntityType; Type = typeof(IEnumerable <>).MakeGenericType(targetType.ClrType); Name = targetType.GetContainingPropertyName(); if (Name == null) { throw new InvalidOperationException( CosmosStrings.NavigationPropertyIsNotAnEmbeddedEntity( navigation.DeclaringEntityType.DisplayName(), navigation.Name)); } Navigation = navigation; AccessExpression = accessExpression; InnerProjection = innerProjection ?? new EntityProjectionExpression( targetType, new RootReferenceExpression(targetType, "")); }