Skip to content

Commit 7b0045b

Browse files
committed
Address review comments
1 parent aa86ce5 commit 7b0045b

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

src/EFCore.SqlServer/Query/Internal/SqlServerAggregateFunctionExpression.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
1111
/// any release. You should only use it directly in your code with extreme caution and knowing that
1212
/// doing so can result in application failures when updating to a new Entity Framework Core release.
1313
/// </summary>
14-
public class SqlServerAggregateFunctionExpression : SqlExpression, IEquatable<SqlServerAggregateFunctionExpression>
14+
public class SqlServerAggregateFunctionExpression : SqlExpression
1515
{
1616
/// <summary>
1717
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -37,12 +37,18 @@ public SqlServerAggregateFunctionExpression(
3737
}
3838

3939
/// <summary>
40-
/// The name of the function.
40+
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
41+
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
42+
/// any release. You should only use it directly in your code with extreme caution and knowing that
43+
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4144
/// </summary>
4245
public virtual string Name { get; }
4346

4447
/// <summary>
45-
/// The list of arguments of this function.
48+
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
49+
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
50+
/// any release. You should only use it directly in your code with extreme caution and knowing that
51+
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4652
/// </summary>
4753
public virtual IReadOnlyList<SqlExpression> Arguments { get; }
4854

@@ -55,12 +61,18 @@ public SqlServerAggregateFunctionExpression(
5561
public virtual IReadOnlyList<OrderingExpression> Orderings { get; }
5662

5763
/// <summary>
58-
/// A bool value indicating if the function can return null result.
64+
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
65+
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
66+
/// any release. You should only use it directly in your code with extreme caution and knowing that
67+
/// doing so can result in application failures when updating to a new Entity Framework Core release.
5968
/// </summary>
6069
public virtual bool IsNullable { get; }
6170

6271
/// <summary>
63-
/// A list of bool values indicating whether individual argument propagate null to the result.
72+
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
73+
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
74+
/// any release. You should only use it directly in your code with extreme caution and knowing that
75+
/// doing so can result in application failures when updating to a new Entity Framework Core release.
6476
/// </summary>
6577
public virtual IReadOnlyList<bool> ArgumentsPropagateNullability { get; }
6678

@@ -125,10 +137,11 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
125137
}
126138

127139
/// <summary>
128-
/// Applies supplied type mapping to this expression.
140+
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
141+
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
142+
/// any release. You should only use it directly in your code with extreme caution and knowing that
143+
/// doing so can result in application failures when updating to a new Entity Framework Core release.
129144
/// </summary>
130-
/// <param name="typeMapping">A relational type mapping to apply.</param>
131-
/// <returns>A new expression which has supplied type mapping.</returns>
132145
public virtual SqlServerAggregateFunctionExpression ApplyTypeMapping(RelationalTypeMapping? typeMapping)
133146
=> new(
134147
Name,
@@ -181,8 +194,7 @@ protected override void Print(ExpressionPrinter expressionPrinter)
181194
public override bool Equals(object? obj)
182195
=> obj is SqlServerAggregateFunctionExpression sqlServerFunctionExpression && Equals(sqlServerFunctionExpression);
183196

184-
/// <inheritdoc />
185-
public virtual bool Equals(SqlServerAggregateFunctionExpression? other)
197+
private bool Equals(SqlServerAggregateFunctionExpression? other)
186198
=> ReferenceEquals(this, other)
187199
|| other is not null
188200
&& base.Equals(other)

src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected override void GenerateLimitOffset(SelectExpression selectExpression)
101101
/// any release. You should only use it directly in your code with extreme caution and knowing that
102102
/// doing so can result in application failures when updating to a new Entity Framework Core release.
103103
/// </summary>
104-
protected virtual Expression VisitAggregateFunction(SqlServerAggregateFunctionExpression aggregateFunctionExpression)
104+
protected virtual Expression VisitSqlServerAggregateFunction(SqlServerAggregateFunctionExpression aggregateFunctionExpression)
105105
{
106106
Sql.Append(aggregateFunctionExpression.Name);
107107

@@ -193,7 +193,7 @@ when tableExpression.FindAnnotation(SqlServerAnnotationNames.TemporalOperationTy
193193
}
194194

195195
case SqlServerAggregateFunctionExpression aggregateFunctionExpression:
196-
return VisitAggregateFunction(aggregateFunctionExpression);
196+
return VisitSqlServerAggregateFunction(aggregateFunctionExpression);
197197
}
198198

199199
return base.VisitExtension(extensionExpression);

src/EFCore.SqlServer/Query/Internal/SqlServerSqlNullabilityProcessor.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ protected virtual SqlExpression VisitAggregateFunction(
9898
}
9999
}
100100

101-
return aggregateFunctionExpression.Update(
102-
arguments ?? aggregateFunctionExpression.Arguments,
103-
orderings ?? aggregateFunctionExpression.Orderings);
101+
return arguments is not null || orderings is not null
102+
? aggregateFunctionExpression.Update(
103+
arguments ?? aggregateFunctionExpression.Arguments,
104+
orderings ?? aggregateFunctionExpression.Orderings)
105+
: aggregateFunctionExpression;
104106
}
105107
}

0 commit comments

Comments
 (0)