Skip to content

Commit 4e0a922

Browse files
authored
Rename "relationship" to "structural property" (#36683)
1 parent 04a4fd7 commit 4e0a922

11 files changed

Lines changed: 130 additions & 130 deletions

src/EFCore.Relational/Query/CollectionResultExpression.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ namespace Microsoft.EntityFrameworkCore.Query;
1414
/// </para>
1515
/// </summary>
1616
/// <param name="queryExpression">Represents the server-side query expression for the collection.</param>
17-
/// <param name="relationship">A navigation associated with this collection, if any.</param>
18-
/// <param name="elementType">The clr type of individual elements in the collection.</param>
17+
/// <param name="structuralProperty">The navigation or complex property associated with the collection, if any.</param>
18+
/// <param name="elementType">The .NET type of individual elements in the collection.</param>
1919
public class CollectionResultExpression(
2020
Expression queryExpression,
21-
IPropertyBase? relationship,
21+
IPropertyBase? structuralProperty,
2222
Type elementType)
2323
: Expression, IPrintableExpression
2424
{
@@ -28,12 +28,12 @@ public class CollectionResultExpression(
2828
public virtual Expression QueryExpression { get; } = queryExpression;
2929

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

3535
/// <summary>
36-
/// The clr type of elements of the collection.
36+
/// The .NET type of elements of the collection.
3737
/// </summary>
3838
public virtual Type ElementType { get; } = elementType;
3939

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

6363
/// <inheritdoc />
6464
public virtual void Print(ExpressionPrinter expressionPrinter)
@@ -70,9 +70,9 @@ public virtual void Print(ExpressionPrinter expressionPrinter)
7070
expressionPrinter.Visit(QueryExpression);
7171
expressionPrinter.AppendLine();
7272

73-
if (Relationship is not null)
73+
if (StructuralProperty is not null)
7474
{
75-
expressionPrinter.Append("Relationship:").AppendLine(Relationship.ToString()!);
75+
expressionPrinter.Append("Structural Property:").AppendLine(StructuralProperty.ToString()!);
7676
}
7777

7878
expressionPrinter.Append("ElementType:").AppendLine(ElementType.ShortDisplayName());
@@ -88,6 +88,6 @@ public virtual void Print(ExpressionPrinter expressionPrinter)
8888
/// <summary>
8989
/// The navigation if associated with the collection.
9090
/// </summary>
91-
[Obsolete("Use Relationship instead.", error: true)]
91+
[Obsolete("Use StructuralProperty instead.", error: true)]
9292
public virtual INavigationBase? Navigation { get; }
9393
}

src/EFCore.Relational/Query/Internal/RelationalProjectionBindingExpressionVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public virtual Expression Translate(SelectExpression selectExpression, Expressio
198198
// expression.Type here will be List<T>
199199
return new CollectionResultExpression(
200200
new ProjectionBindingExpression(_selectExpression, _clientProjections.Count - 1, expression.Type),
201-
relationship: null,
201+
structuralProperty: null,
202202
methodCallExpression.Method.GetGenericArguments()[0]);
203203
}
204204
}
@@ -219,7 +219,7 @@ public virtual Expression Translate(SelectExpression selectExpression, Expressio
219219
_selectExpression, _clientProjections.Count - 1, type);
220220
return subquery.ResultCardinality == ResultCardinality.Enumerable
221221
? new CollectionResultExpression(
222-
projectionBindingExpression, relationship: null, subquery.ShaperExpression.Type)
222+
projectionBindingExpression, structuralProperty: null, subquery.ShaperExpression.Type)
223223
: projectionBindingExpression;
224224
}
225225
}

src/EFCore.Relational/Query/JsonQueryExpression.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ public virtual SqlExpression BindProperty(IProperty property)
146146
}
147147

148148
/// <summary>
149-
/// Binds a relationship with this JSON query expression to get the SQL representation.
149+
/// Binds a navigation or complex property with this JSON query expression to get the SQL representation.
150150
/// </summary>
151-
/// <param name="relationship">The navigation or complex property to bind.</param>
151+
/// <param name="structuralProperty">The navigation or complex property to bind.</param>
152152
/// <returns>An JSON query expression for the target entity or complex type.</returns>
153-
public virtual JsonQueryExpression BindRelationship(IPropertyBase relationship)
153+
public virtual JsonQueryExpression BindStructuralProperty(IPropertyBase structuralProperty)
154154
{
155-
switch (relationship)
155+
switch (structuralProperty)
156156
{
157157
case INavigation navigation:
158158
{

src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ Expression ExpandOwnedNavigation(INavigation navigation)
18141814

18151815
if (TryGetJsonQueryExpression(shaper, out var jsonQueryExpression))
18161816
{
1817-
var newJsonQueryExpression = jsonQueryExpression.BindRelationship(navigation);
1817+
var newJsonQueryExpression = jsonQueryExpression.BindStructuralProperty(navigation);
18181818

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

src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.ClientMethods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ static async Task<RelationalDataReader> InitializeReaderAsync(
10551055
QueryContext queryContext,
10561056
object[]? keyPropertyValues,
10571057
JsonReaderData? jsonReaderData,
1058-
IPropertyBase relationship,
1058+
IPropertyBase structuralProperty,
10591059
Func<QueryContext, object[]?, JsonReaderData, TEntity> innerShaper)
10601060
where TEntity : class
10611061
{
@@ -1076,7 +1076,7 @@ static async Task<RelationalDataReader> InitializeReaderAsync(
10761076
throw new InvalidOperationException(CoreStrings.JsonReaderInvalidTokenType(tokenType.ToString()));
10771077
}
10781078

1079-
var collectionAccessor = relationship.GetCollectionAccessor();
1079+
var collectionAccessor = structuralProperty.GetCollectionAccessor();
10801080
var result = (TResult)collectionAccessor!.Create();
10811081

10821082
object[]? newKeyPropertyValues = null;

0 commit comments

Comments
 (0)