Skip to content

Commit 2108143

Browse files
committed
Merge branch 'release/7.0-rc1' into release/7.0
2 parents 0efc506 + 022df8f commit 2108143

34 files changed

+395
-161
lines changed

src/EFCore.Cosmos/Metadata/Conventions/CosmosRuntimeModelConvention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected override void ProcessModelAnnotations(
5656
/// <param name="runtimeEntityType">The target entity type that will contain the annotations.</param>
5757
/// <param name="runtime">Indicates whether the given annotations are runtime annotations.</param>
5858
protected override void ProcessEntityTypeAnnotations(
59-
IDictionary<string, object?> annotations,
59+
Dictionary<string, object?> annotations,
6060
IEntityType entityType,
6161
RuntimeEntityType runtimeEntityType,
6262
bool runtime)

src/EFCore.Relational/Extensions/RelationalQueryableExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ internal static readonly MethodInfo ExecuteDeleteMethodInfo
342342
/// </para>
343343
/// </remarks>
344344
/// <param name="source">The source query.</param>
345-
/// <param name="setPropertyStatements">A collection of set property statements specifying properties to update.</param>
345+
/// <param name="setPropertyCalls">A collection of set property statements specifying properties to update.</param>
346346
/// <returns>The total number of rows updated in the database.</returns>
347347
public static int ExecuteUpdate<TSource>(
348348
this IQueryable<TSource> source,
349-
Expression<Func<SetPropertyStatements<TSource>, SetPropertyStatements<TSource>>> setPropertyStatements)
349+
Expression<Func<SetPropertyCalls<TSource>, SetPropertyCalls<TSource>>> setPropertyCalls)
350350
=> source.Provider.Execute<int>(
351-
Expression.Call(ExecuteUpdateMethodInfo.MakeGenericMethod(typeof(TSource)), source.Expression, setPropertyStatements));
351+
Expression.Call(ExecuteUpdateMethodInfo.MakeGenericMethod(typeof(TSource)), source.Expression, setPropertyCalls));
352352

353353
/// <summary>
354354
/// Asynchronously updates database rows for the entity instances which match the LINQ query from the database.
@@ -366,17 +366,17 @@ public static int ExecuteUpdate<TSource>(
366366
/// </para>
367367
/// </remarks>
368368
/// <param name="source">The source query.</param>
369-
/// <param name="setPropertyStatements">A collection of set property statements specifying properties to update.</param>
369+
/// <param name="setPropertyCalls">A collection of set property statements specifying properties to update.</param>
370370
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
371371
/// <returns>The total number of rows updated in the database.</returns>
372372
public static Task<int> ExecuteUpdateAsync<TSource>(
373373
this IQueryable<TSource> source,
374-
Expression<Func<SetPropertyStatements<TSource>, SetPropertyStatements<TSource>>> setPropertyStatements,
374+
Expression<Func<SetPropertyCalls<TSource>, SetPropertyCalls<TSource>>> setPropertyCalls,
375375
CancellationToken cancellationToken = default)
376376
=> source.Provider is IAsyncQueryProvider provider
377377
? provider.ExecuteAsync<Task<int>>(
378378
Expression.Call(
379-
ExecuteUpdateMethodInfo.MakeGenericMethod(typeof(TSource)), source.Expression, setPropertyStatements), cancellationToken)
379+
ExecuteUpdateMethodInfo.MakeGenericMethod(typeof(TSource)), source.Expression, setPropertyCalls), cancellationToken)
380380
: throw new InvalidOperationException(CoreStrings.IQueryableProviderNotAsync);
381381

382382
internal static readonly MethodInfo ExecuteUpdateMethodInfo

src/EFCore.Relational/Metadata/Conventions/RelationalRuntimeModelConvention.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected override void ProcessModelAnnotations(
113113
/// <param name="runtimeEntityType">The target entity type that will contain the annotations.</param>
114114
/// <param name="runtime">Indicates whether the given annotations are runtime annotations.</param>
115115
protected override void ProcessEntityTypeAnnotations(
116-
IDictionary<string, object?> annotations,
116+
Dictionary<string, object?> annotations,
117117
IEntityType entityType,
118118
RuntimeEntityType runtimeEntityType,
119119
bool runtime)
@@ -405,7 +405,7 @@ protected virtual void ProcessPropertyOverridesAnnotations(
405405
/// <param name="runtimeKey">The target key that will contain the annotations.</param>
406406
/// <param name="runtime">Indicates whether the given annotations are runtime annotations.</param>
407407
protected override void ProcessKeyAnnotations(
408-
IDictionary<string, object?> annotations,
408+
Dictionary<string, object?> annotations,
409409
IKey key,
410410
RuntimeKey runtimeKey,
411411
bool runtime)

src/EFCore.Relational/Properties/RelationalStrings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/EFCore.Relational/Properties/RelationalStrings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@
446446
<value>Unable to translate a collection subquery in a projection since either parent or the subquery doesn't project necessary information required to uniquely identify it and correctly generate results on the client side. This can happen when trying to correlate on keyless entity type. This can also happen for some cases of projection before 'Distinct' or some shapes of grouping key in case of 'GroupBy'. These should either contain all key properties of the entity that the operation is applied on, or only contain simple property access expressions.</value>
447447
</data>
448448
<data name="InvalidArgumentToExecuteUpdate" xml:space="preserve">
449-
<value>The 'setPropertyStatements' argument to 'ExecuteUpdate' may only contain a chain of 'SetProperty' expressing the properties to be updated.</value>
449+
<value>The 'setPropertyCalls' argument to 'ExecuteUpdate' may only contain a chain of 'SetProperty' expressing the properties to be updated.</value>
450450
</data>
451451
<data name="InvalidCommandTimeout" xml:space="preserve">
452452
<value>The specified 'CommandTimeout' value '{value}' is not valid. It must be a positive number.</value>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class SelectExpressionPruningExpressionVisitor : ExpressionVisitor
4343
case UpdateExpression updateExpression:
4444
return updateExpression.Update(
4545
updateExpression.SelectExpression.Prune(),
46-
updateExpression.SetColumnValues.Select(e => new SetColumnValue(e.Column, (SqlExpression)Visit(e.Value))).ToList());
46+
updateExpression.ColumnValueSetters.Select(e => new ColumnValueSetter(e.Column, (SqlExpression)Visit(e.Value))).ToList());
4747

4848
default:
4949
return base.Visit(expression);

src/EFCore.Relational/Query/JsonQueryExpression.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public JsonQueryExpression(
3333
collection,
3434
keyPropertyMap,
3535
type,
36-
jsonPath: new SqlConstantExpression(Constant("$"), typeMapping: null),
36+
path: new SqlConstantExpression(Constant("$"), typeMapping: null),
3737
jsonColumn.IsNullable)
3838
{
3939
}
@@ -44,7 +44,7 @@ private JsonQueryExpression(
4444
bool collection,
4545
IReadOnlyDictionary<IProperty, ColumnExpression> keyPropertyMap,
4646
Type type,
47-
SqlExpression jsonPath,
47+
SqlExpression path,
4848
bool nullable)
4949
{
5050
Check.DebugAssert(entityType.FindPrimaryKey() != null, "primary key is null.");
@@ -54,7 +54,7 @@ private JsonQueryExpression(
5454
IsCollection = collection;
5555
_keyPropertyMap = keyPropertyMap;
5656
Type = type;
57-
JsonPath = jsonPath;
57+
Path = path;
5858
_nullable = nullable;
5959
}
6060

@@ -76,7 +76,7 @@ private JsonQueryExpression(
7676
/// <summary>
7777
/// The JSON path leading to the entity from the root of the JSON stored in the column.
7878
/// </summary>
79-
public virtual SqlExpression JsonPath { get; }
79+
public virtual SqlExpression Path { get; }
8080

8181
/// <summary>
8282
/// The value indicating whether this expression is nullable.
@@ -112,7 +112,7 @@ public virtual SqlExpression BindProperty(IProperty property)
112112

113113
var newPath = new SqlBinaryExpression(
114114
ExpressionType.Add,
115-
JsonPath,
115+
Path,
116116
pathSegment,
117117
typeof(string),
118118
typeMapping: null);
@@ -148,7 +148,7 @@ public virtual JsonQueryExpression BindNavigation(INavigation navigation)
148148

149149
var newJsonPath = new SqlBinaryExpression(
150150
ExpressionType.Add,
151-
JsonPath,
151+
Path,
152152
pathSegment,
153153
typeof(string),
154154
typeMapping: null);
@@ -190,27 +190,26 @@ public virtual JsonQueryExpression MakeNullable()
190190
/// Makes this JSON query expression nullable re-using existing nullable key properties
191191
/// </summary>
192192
/// <returns>A new expression which has <see cref="IsNullable" /> property set to true.</returns>
193-
[EntityFrameworkInternal]
194-
public virtual JsonQueryExpression MakeNullable(IReadOnlyDictionary<IProperty, ColumnExpression> nullableKeyPropertyMap)
193+
internal virtual JsonQueryExpression MakeNullable(IReadOnlyDictionary<IProperty, ColumnExpression> nullableKeyPropertyMap)
195194
=> Update(
196195
JsonColumn.MakeNullable(),
197196
nullableKeyPropertyMap,
198-
JsonPath,
197+
Path,
199198
nullable: true);
200199

201200
/// <inheritdoc />
202201
public virtual void Print(ExpressionPrinter expressionPrinter)
203202
{
204203
expressionPrinter.Append("JsonQueryExpression(");
205204
expressionPrinter.Visit(JsonColumn);
206-
expressionPrinter.Append($", \"{string.Join(".", JsonPath)}\")");
205+
expressionPrinter.Append($", \"{string.Join(".", Path)}\")");
207206
}
208207

209208
/// <inheritdoc />
210209
protected override Expression VisitChildren(ExpressionVisitor visitor)
211210
{
212211
var jsonColumn = (ColumnExpression)visitor.Visit(JsonColumn);
213-
var jsonPath = (SqlExpression)visitor.Visit(JsonPath);
212+
var jsonPath = (SqlExpression)visitor.Visit(Path);
214213

215214
// TODO: also visit columns in the _keyPropertyMap?
216215
return Update(jsonColumn, _keyPropertyMap, jsonPath, IsNullable);
@@ -222,19 +221,19 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
222221
/// </summary>
223222
/// <param name="jsonColumn">The <see cref="JsonColumn" /> property of the result.</param>
224223
/// <param name="keyPropertyMap">The map of key properties and columns they map to.</param>
225-
/// <param name="jsonPath">The <see cref="JsonPath" /> property of the result.</param>
224+
/// <param name="path">The <see cref="Path" /> property of the result.</param>
226225
/// <param name="nullable">The <see cref="IsNullable" /> property of the result.</param>
227226
/// <returns>This expression if no children changed, or an expression with the updated children.</returns>
228227
public virtual JsonQueryExpression Update(
229228
ColumnExpression jsonColumn,
230229
IReadOnlyDictionary<IProperty, ColumnExpression> keyPropertyMap,
231-
SqlExpression jsonPath,
230+
SqlExpression path,
232231
bool nullable)
233232
=> jsonColumn != JsonColumn
234233
|| keyPropertyMap.Count != _keyPropertyMap.Count
235234
|| keyPropertyMap.Zip(_keyPropertyMap, (n, o) => n.Value != o.Value).Any(x => x)
236-
|| jsonPath != JsonPath
237-
? new JsonQueryExpression(EntityType, jsonColumn, IsCollection, keyPropertyMap, Type, jsonPath, nullable)
235+
|| path != Path
236+
? new JsonQueryExpression(EntityType, jsonColumn, IsCollection, keyPropertyMap, Type, path, nullable)
238237
: this;
239238

240239
/// <inheritdoc />
@@ -248,7 +247,7 @@ private bool Equals(JsonQueryExpression jsonQueryExpression)
248247
=> EntityType.Equals(jsonQueryExpression.EntityType)
249248
&& JsonColumn.Equals(jsonQueryExpression.JsonColumn)
250249
&& IsCollection.Equals(jsonQueryExpression.IsCollection)
251-
&& JsonPath.Equals(jsonQueryExpression.JsonPath)
250+
&& Path.Equals(jsonQueryExpression.Path)
252251
&& IsNullable == jsonQueryExpression.IsNullable
253252
&& KeyPropertyMapEquals(jsonQueryExpression._keyPropertyMap);
254253

@@ -273,6 +272,6 @@ private bool KeyPropertyMapEquals(IReadOnlyDictionary<IProperty, ColumnExpressio
273272
/// <inheritdoc />
274273
public override int GetHashCode()
275274
// not incorporating _keyPropertyMap into the hash, too much work
276-
=> HashCode.Combine(EntityType, JsonColumn, IsCollection, JsonPath, IsNullable);
275+
=> HashCode.Combine(EntityType, JsonColumn, IsCollection, Path, IsNullable);
277276
}
278277
}

src/EFCore.Relational/Query/QuerySqlGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ protected override Expression VisitUpdate(UpdateExpression updateExpression)
12741274
using (_relationalCommandBuilder.Indent())
12751275
{
12761276
_relationalCommandBuilder.Append("SET ");
1277-
GenerateList(updateExpression.SetColumnValues,
1277+
GenerateList(updateExpression.ColumnValueSetters,
12781278
e =>
12791279
{
12801280
_relationalCommandBuilder.Append($"{_sqlGenerationHelper.DelimitIdentifier(e.Column.Name)} = ");

src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,18 +1096,18 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
10961096
}
10971097

10981098
/// <summary>
1099-
/// Translates <see cref="RelationalQueryableExtensions.ExecuteUpdate{TSource}(IQueryable{TSource}, Expression{Func{SetPropertyStatements{TSource}, SetPropertyStatements{TSource}}})" /> method
1099+
/// Translates <see cref="RelationalQueryableExtensions.ExecuteUpdate{TSource}(IQueryable{TSource}, Expression{Func{SetPropertyCalls{TSource}, SetPropertyCalls{TSource}}})" /> method
11001100
/// over the given source.
11011101
/// </summary>
11021102
/// <param name="source">The shaped query on which the operator is applied.</param>
1103-
/// <param name="setPropertyStatements">The lambda expression containing <see cref="SetPropertyStatements{TSource}.SetProperty{TProperty}(Expression{Func{TSource, TProperty}}, Expression{Func{TSource, TProperty}})"/> statements.</param>
1103+
/// <param name="setPropertyCalls">The lambda expression containing <see cref="SetPropertyCalls{TSource}.SetProperty{TProperty}(Expression{Func{TSource, TProperty}}, Expression{Func{TSource, TProperty}})"/> statements.</param>
11041104
/// <returns>The non query after translation.</returns>
11051105
protected virtual NonQueryExpression? TranslateExecuteUpdate(
11061106
ShapedQueryExpression source,
1107-
LambdaExpression setPropertyStatements)
1107+
LambdaExpression setPropertyCalls)
11081108
{
11091109
var propertyValueLambdaExpressions = new List<(LambdaExpression, LambdaExpression)>();
1110-
PopulateSetPropertyStatements(setPropertyStatements.Body, propertyValueLambdaExpressions, setPropertyStatements.Parameters[0]);
1110+
PopulateSetPropertyCalls(setPropertyCalls.Body, propertyValueLambdaExpressions, setPropertyCalls.Parameters[0]);
11111111
if (TranslationErrorDetails != null)
11121112
{
11131113
return null;
@@ -1240,7 +1240,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
12401240
List<(LambdaExpression, LambdaExpression)> propertyValueLambdaExpressions,
12411241
List<Expression>? leftExpressions)
12421242
{
1243-
var setColumnValues = new List<SetColumnValue>();
1243+
var columnValueSetters = new List<ColumnValueSetter>();
12441244
for (var i = 0; i < propertyValueLambdaExpressions.Count; i++)
12451245
{
12461246
var (propertyExpression, valueExpression) = propertyValueLambdaExpressions[i];
@@ -1266,7 +1266,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
12661266
var translation = visitor._sqlTranslator.Translate(setter);
12671267
if (translation is SqlBinaryExpression { OperatorType: ExpressionType.Equal, Left: ColumnExpression column } sqlBinaryExpression)
12681268
{
1269-
setColumnValues.Add(new SetColumnValue(column, sqlBinaryExpression.Right));
1269+
columnValueSetters.Add(new ColumnValueSetter(column, sqlBinaryExpression.Right));
12701270
}
12711271
else
12721272
{
@@ -1280,10 +1280,10 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
12801280
selectExpression.ReplaceProjection(new List<Expression>());
12811281
selectExpression.ApplyProjection();
12821282

1283-
return new NonQueryExpression(new UpdateExpression(tableExpression, selectExpression, setColumnValues));
1283+
return new NonQueryExpression(new UpdateExpression(tableExpression, selectExpression, columnValueSetters));
12841284
}
12851285

1286-
void PopulateSetPropertyStatements(
1286+
void PopulateSetPropertyCalls(
12871287
Expression expression, List<(LambdaExpression, LambdaExpression)> list, ParameterExpression parameter)
12881288
{
12891289
switch (expression)
@@ -1294,13 +1294,13 @@ void PopulateSetPropertyStatements(
12941294

12951295
case MethodCallExpression methodCallExpression
12961296
when methodCallExpression.Method.IsGenericMethod
1297-
&& methodCallExpression.Method.Name == nameof(SetPropertyStatements<int>.SetProperty)
1297+
&& methodCallExpression.Method.Name == nameof(SetPropertyCalls<int>.SetProperty)
12981298
&& methodCallExpression.Method.DeclaringType!.IsGenericType
1299-
&& methodCallExpression.Method.DeclaringType.GetGenericTypeDefinition() == typeof(SetPropertyStatements<>):
1299+
&& methodCallExpression.Method.DeclaringType.GetGenericTypeDefinition() == typeof(SetPropertyCalls<>):
13001300

13011301
list.Add((methodCallExpression.Arguments[0].UnwrapLambdaFromQuote(),
13021302
methodCallExpression.Arguments[1].UnwrapLambdaFromQuote()));
1303-
PopulateSetPropertyStatements(methodCallExpression.Object!, list, parameter);
1303+
PopulateSetPropertyCalls(methodCallExpression.Object!, list, parameter);
13041304

13051305
break;
13061306

0 commit comments

Comments
 (0)