Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/EFCore.Relational/Query/CollectionResultExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Microsoft.EntityFrameworkCore.Query;
/// </para>
/// </summary>
/// <param name="queryExpression">Represents the server-side query expression for the collection.</param>
/// <param name="relationship">A navigation associated with this collection, if any.</param>
/// <param name="elementType">The clr type of individual elements in the collection.</param>
/// <param name="structuralProperty">The navigation or complex property associated with the collection, if any.</param>
/// <param name="elementType">The .NET type of individual elements in the collection.</param>
public class CollectionResultExpression(
Expression queryExpression,
IPropertyBase? relationship,
IPropertyBase? structuralProperty,
Type elementType)
: Expression, IPrintableExpression
{
Expand All @@ -28,12 +28,12 @@ public class CollectionResultExpression(
public virtual Expression QueryExpression { get; } = queryExpression;

/// <summary>
/// The relationship associated with the collection, if any.
/// The navigation or complex property associated with the collection, if any.
/// </summary>
public virtual IPropertyBase? Relationship { get; } = relationship;
public virtual IPropertyBase? StructuralProperty { get; } = structuralProperty;

/// <summary>
/// The clr type of elements of the collection.
/// The .NET type of elements of the collection.
/// </summary>
public virtual Type ElementType { get; } = elementType;

Expand All @@ -58,7 +58,7 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
public virtual CollectionResultExpression Update(Expression queryExpression)
=> queryExpression == QueryExpression
? this
: new CollectionResultExpression(queryExpression, Relationship, ElementType);
: new CollectionResultExpression(queryExpression, StructuralProperty, ElementType);

/// <inheritdoc />
public virtual void Print(ExpressionPrinter expressionPrinter)
Expand All @@ -70,9 +70,9 @@ public virtual void Print(ExpressionPrinter expressionPrinter)
expressionPrinter.Visit(QueryExpression);
expressionPrinter.AppendLine();

if (Relationship is not null)
if (StructuralProperty is not null)
{
expressionPrinter.Append("Relationship:").AppendLine(Relationship.ToString()!);
expressionPrinter.Append("Structural Property:").AppendLine(StructuralProperty.ToString()!);
}

expressionPrinter.Append("ElementType:").AppendLine(ElementType.ShortDisplayName());
Expand All @@ -88,6 +88,6 @@ public virtual void Print(ExpressionPrinter expressionPrinter)
/// <summary>
/// The navigation if associated with the collection.
/// </summary>
[Obsolete("Use Relationship instead.", error: true)]
[Obsolete("Use StructuralProperty instead.", error: true)]
public virtual INavigationBase? Navigation { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public virtual Expression Translate(SelectExpression selectExpression, Expressio
// expression.Type here will be List<T>
return new CollectionResultExpression(
new ProjectionBindingExpression(_selectExpression, _clientProjections.Count - 1, expression.Type),
relationship: null,
structuralProperty: null,
methodCallExpression.Method.GetGenericArguments()[0]);
}
}
Expand All @@ -219,7 +219,7 @@ public virtual Expression Translate(SelectExpression selectExpression, Expressio
_selectExpression, _clientProjections.Count - 1, type);
return subquery.ResultCardinality == ResultCardinality.Enumerable
? new CollectionResultExpression(
projectionBindingExpression, relationship: null, subquery.ShaperExpression.Type)
projectionBindingExpression, structuralProperty: null, subquery.ShaperExpression.Type)
: projectionBindingExpression;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/EFCore.Relational/Query/JsonQueryExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ public virtual SqlExpression BindProperty(IProperty property)
}

/// <summary>
/// Binds a relationship with this JSON query expression to get the SQL representation.
/// Binds a navigation or complex property with this JSON query expression to get the SQL representation.
/// </summary>
/// <param name="relationship">The navigation or complex property to bind.</param>
/// <param name="structuralProperty">The navigation or complex property to bind.</param>
/// <returns>An JSON query expression for the target entity or complex type.</returns>
public virtual JsonQueryExpression BindRelationship(IPropertyBase relationship)
public virtual JsonQueryExpression BindStructuralProperty(IPropertyBase structuralProperty)
{
switch (relationship)
switch (structuralProperty)
{
case INavigation navigation:
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ Expression ExpandOwnedNavigation(INavigation navigation)

if (TryGetJsonQueryExpression(shaper, out var jsonQueryExpression))
{
var newJsonQueryExpression = jsonQueryExpression.BindRelationship(navigation);
var newJsonQueryExpression = jsonQueryExpression.BindStructuralProperty(navigation);

Debug.Assert(!navigation.IsOnDependent, "JSON navigations should always be from principal do dependent");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ static async Task<RelationalDataReader> InitializeReaderAsync(
QueryContext queryContext,
object[]? keyPropertyValues,
JsonReaderData? jsonReaderData,
IPropertyBase relationship,
IPropertyBase structuralProperty,
Func<QueryContext, object[]?, JsonReaderData, TEntity> innerShaper)
where TEntity : class
{
Expand All @@ -1076,7 +1076,7 @@ static async Task<RelationalDataReader> InitializeReaderAsync(
throw new InvalidOperationException(CoreStrings.JsonReaderInvalidTokenType(tokenType.ToString()));
}

var collectionAccessor = relationship.GetCollectionAccessor();
var collectionAccessor = structuralProperty.GetCollectionAccessor();
var result = (TResult)collectionAccessor!.Create();

object[]? newKeyPropertyValues = null;
Expand Down
Loading
Loading