diff --git a/All.sln.DotSettings b/All.sln.DotSettings
index d794c295092..880a655eacd 100644
--- a/All.sln.DotSettings
+++ b/All.sln.DotSettings
@@ -80,12 +80,14 @@
True
False
True
- False
+ True
True
True
CHOP_IF_LONG
+ True
True
True
+ CHOP_IF_LONG
140
True
CHOP_ALWAYS
@@ -167,10 +169,15 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
- True
- ..\EFCore.sln.DotSettings
- True
- 1
+
+
+ True
+ C:\repos\EntityFrameworkCore\All.sln.DotSettings
+
+
+
+ True
+ 2
DO_NOTHING
True
True
@@ -187,13 +194,20 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
True
True
True
+ False
+ True
True
True
True
True
+ True
True
True
True
+ False
+ True
+ False
+ True
True
True
True
diff --git a/EFCore.sln.DotSettings b/EFCore.sln.DotSettings
deleted file mode 100644
index e7d45a2a845..00000000000
--- a/EFCore.sln.DotSettings
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/benchmark/EF.Benchmarks.Shared/Initialization/ColdStartSandbox.cs b/benchmark/EF.Benchmarks.Shared/Initialization/ColdStartSandbox.cs
index 2a4b580e2a8..5b98d8004e7 100644
--- a/benchmark/EF.Benchmarks.Shared/Initialization/ColdStartSandbox.cs
+++ b/benchmark/EF.Benchmarks.Shared/Initialization/ColdStartSandbox.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if NET461
-
using System;
namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
diff --git a/benchmark/EF6.SqlServer.Benchmarks/Support/Program.cs b/benchmark/EF6.SqlServer.Benchmarks/Support/Program.cs
index dfbc9c83601..e57a97c3a64 100644
--- a/benchmark/EF6.SqlServer.Benchmarks/Support/Program.cs
+++ b/benchmark/EF6.SqlServer.Benchmarks/Support/Program.cs
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Benchmarks
{
diff --git a/benchmark/EFCore.SqlServer.Benchmarks/Support/Program.cs b/benchmark/EFCore.SqlServer.Benchmarks/Support/Program.cs
index dfbc9c83601..e57a97c3a64 100644
--- a/benchmark/EFCore.SqlServer.Benchmarks/Support/Program.cs
+++ b/benchmark/EFCore.SqlServer.Benchmarks/Support/Program.cs
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Benchmarks
{
diff --git a/benchmark/EFCore.Sqlite.Benchmarks/Support/Program.cs b/benchmark/EFCore.Sqlite.Benchmarks/Support/Program.cs
index dfbc9c83601..e57a97c3a64 100644
--- a/benchmark/EFCore.Sqlite.Benchmarks/Support/Program.cs
+++ b/benchmark/EFCore.Sqlite.Benchmarks/Support/Program.cs
@@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Benchmarks
{
diff --git a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
index bde438fdea6..c3c16d3cb48 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosEntityTypeExtensions.cs
@@ -27,8 +27,8 @@ public static string GetContainer([NotNull] this IEntityType entityType) =>
private static string GetDefaultContainer(IEntityType entityType)
=> entityType.IsOwned()
- ? null
- : entityType.Model.GetDefaultContainer()
+ ? null
+ : entityType.Model.GetDefaultContainer()
?? entityType.ShortName();
///
diff --git a/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
index 9a0d0c716c5..dbea08211b4 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosModelExtensions.cs
@@ -38,7 +38,8 @@ public static void SetDefaultContainer([NotNull] this IMutableModel model, [CanB
/// The model.
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
- public static void SetDefaultContainer([NotNull] this IConventionModel model, [CanBeNull] string name, bool fromDataAnnotation = false)
+ public static void SetDefaultContainer(
+ [NotNull] this IConventionModel model, [CanBeNull] string name, bool fromDataAnnotation = false)
=> model.SetOrRemoveAnnotation(
CosmosAnnotationNames.ContainerName,
Check.NullButNotEmpty(name, nameof(name)),
diff --git a/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs b/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
index e3452eea563..4fa98985825 100644
--- a/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
+++ b/src/EFCore.Cosmos/Extensions/CosmosPropertyExtensions.cs
@@ -60,7 +60,8 @@ public static void SetPropertyName([NotNull] this IMutableProperty property, [Ca
/// The property.
/// The name to set.
/// Indicates whether the configuration was specified using a data annotation.
- public static void SetPropertyName([NotNull] this IConventionProperty property, [CanBeNull] string name, bool fromDataAnnotation = false)
+ public static void SetPropertyName(
+ [NotNull] this IConventionProperty property, [CanBeNull] string name, bool fromDataAnnotation = false)
=> property.SetOrRemoveAnnotation(
CosmosAnnotationNames.PropertyName,
name,
diff --git a/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs b/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
index c6555eb1104..8c09046acce 100644
--- a/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
+++ b/src/EFCore.Cosmos/Query/Internal/ContainsTranslator.cs
@@ -44,8 +44,8 @@ public virtual SqlExpression Translate(SqlExpression instance, MethodInfo method
}
if ((method.DeclaringType.GetInterfaces().Contains(typeof(IList))
- || method.DeclaringType.IsGenericType
- && method.DeclaringType.GetGenericTypeDefinition() == typeof(ICollection<>))
+ || method.DeclaringType.IsGenericType
+ && method.DeclaringType.GetGenericTypeDefinition() == typeof(ICollection<>))
&& string.Equals(method.Name, nameof(IList.Contains)))
{
return _sqlExpressionFactory.In(arguments[0], instance, false);
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
index 4f37e8dcfcd..2cf539c6b80 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
@@ -310,7 +310,6 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
throw new InvalidOperationException(CoreStrings.QueryFailed(methodCallExpression.Print(), GetType().Name));
}
-
Expression navigationProjection;
var navigation = _includedNavigations.FirstOrDefault(n => n.Name == memberName);
if (navigation == null)
@@ -367,16 +366,16 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
{
var genericMethod = method.IsGenericMethod ? method.GetGenericMethodDefinition() : null;
var visitedSource = Visit(methodCallExpression.Arguments[0]);
-
+
switch (method.Name)
{
case nameof(Queryable.AsQueryable)
- when genericMethod == QueryableMethods.AsQueryable:
+ when genericMethod == QueryableMethods.AsQueryable:
// Unwrap AsQueryable
return visitedSource;
case nameof(Queryable.Select)
- when genericMethod == QueryableMethods.Select:
+ when genericMethod == QueryableMethods.Select:
if (!(visitedSource is CollectionShaperExpression shaper))
{
return null;
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
index 8fa8e9037ee..59258262658 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitor.cs
@@ -11,7 +11,6 @@
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.Query;
diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
index 166504aebc4..5b6743565d3 100644
--- a/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
+++ b/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
@@ -41,8 +41,10 @@ public QueryingEnumerable(
_contextType = contextType;
_logger = logger;
}
+
public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new AsyncEnumerator(this, cancellationToken);
+
public IEnumerator GetEnumerator() => new Enumerator(this);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
index a8f4d7f4a69..6940add6b62 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs
@@ -187,11 +187,9 @@ public virtual async Task DeleteDatabaseOnceAsync(
{
return false;
}
- else
- {
- response.EnsureSuccessStatusCode();
- return response.StatusCode == HttpStatusCode.NoContent;
- }
+
+ response.EnsureSuccessStatusCode();
+ return response.StatusCode == HttpStatusCode.NoContent;
}
}
@@ -242,11 +240,9 @@ private async Task CreateContainerIfNotExistsOnceAsync(
{
return false;
}
- else
- {
- response.EnsureSuccessStatusCode();
- return response.StatusCode == HttpStatusCode.Created;
- }
+
+ response.EnsureSuccessStatusCode();
+ return response.StatusCode == HttpStatusCode.Created;
}
}
diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
index f7551495ebd..059b1dff050 100644
--- a/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
+++ b/src/EFCore.Cosmos/Storage/Internal/CosmosExecutionStrategy.cs
@@ -118,7 +118,7 @@ protected override bool ShouldRetryOn(Exception exception)
static bool IsTransient(HttpStatusCode statusCode)
=> statusCode == HttpStatusCode.ServiceUnavailable
- || statusCode == (HttpStatusCode)429; // TooManyRequests
+ || statusCode == (HttpStatusCode)429; // TooManyRequests
}
///
diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs
index 13a1f49dbe4..517a91f46ec 100644
--- a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs
+++ b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs
@@ -81,7 +81,7 @@ public virtual string WriteCode(
if (finalContextNamespace != modelNamespace)
{
- _sb.AppendLine(String.Concat("using ", modelNamespace, ";"));
+ _sb.AppendLine(string.Concat("using ", modelNamespace, ";"));
}
_sb.AppendLine();
diff --git a/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs b/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
index ab4769e0420..52ae43f02bd 100644
--- a/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/EntityProjectionExpression.cs
@@ -12,6 +12,7 @@ namespace Microsoft.EntityFrameworkCore.InMemory.Query.Internal
public class EntityProjectionExpression : Expression, IPrintableExpression
{
private readonly IDictionary _readExpressionMap;
+
private readonly IDictionary _navigationExpressionsCache
= new Dictionary();
@@ -60,7 +61,7 @@ public virtual void AddNavigationBinding(INavigation navigation, EntityShaperExp
&& !navigation.DeclaringEntityType.IsAssignableFrom(EntityType))
{
throw new InvalidOperationException(
- $"Called EntityProjectionExpression.AddNavigationBinding() with incorrect INavigation. " +
+ "Called EntityProjectionExpression.AddNavigationBinding() with incorrect INavigation. " +
$"EntityType:{EntityType.DisplayName()}, Property:{navigation.Name}");
}
@@ -73,7 +74,7 @@ public virtual EntityShaperExpression BindNavigation(INavigation navigation)
&& !navigation.DeclaringEntityType.IsAssignableFrom(EntityType))
{
throw new InvalidOperationException(
- $"Called EntityProjectionExpression.BindNavigation() with incorrect INavigation. " +
+ "Called EntityProjectionExpression.BindNavigation() with incorrect INavigation. " +
$"EntityType:{EntityType.DisplayName()}, Property:{navigation.Name}");
}
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
index c53ae429091..da002da20f8 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs
@@ -74,7 +74,8 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
var newLeft = Visit(binaryExpression.Left);
var newRight = Visit(binaryExpression.Right);
- if (newLeft == null || newRight == null)
+ if (newLeft == null
+ || newRight == null)
{
return null;
}
@@ -101,7 +102,9 @@ protected override Expression VisitConditional(ConditionalExpression conditional
var ifTrue = Visit(conditionalExpression.IfTrue);
var ifFalse = Visit(conditionalExpression.IfFalse);
- if (test == null || ifTrue == null || ifFalse == null)
+ if (test == null
+ || ifTrue == null
+ || ifFalse == null)
{
return null;
}
@@ -124,15 +127,16 @@ protected override Expression VisitConditional(ConditionalExpression conditional
protected override Expression VisitMember(MemberExpression memberExpression)
{
var innerExpression = Visit(memberExpression.Expression);
- if (memberExpression.Expression != null && innerExpression == null)
+ if (memberExpression.Expression != null
+ && innerExpression == null)
{
return null;
}
if ((innerExpression is EntityProjectionExpression
- || (innerExpression is UnaryExpression innerUnaryExpression
- && innerUnaryExpression.NodeType == ExpressionType.Convert
- && innerUnaryExpression.Operand is EntityProjectionExpression))
+ || (innerExpression is UnaryExpression innerUnaryExpression
+ && innerUnaryExpression.NodeType == ExpressionType.Convert
+ && innerUnaryExpression.Operand is EntityProjectionExpression))
&& TryBindMember(innerExpression, MemberIdentity.Create(memberExpression.Member), memberExpression.Type, out var result))
{
return result;
@@ -140,8 +144,8 @@ protected override Expression VisitMember(MemberExpression memberExpression)
static bool shouldApplyNullProtectionForMemberAccess(Type callerType, string memberName)
=> !(callerType.IsGenericType
- && callerType.GetGenericTypeDefinition() == typeof(Nullable<>)
- && (memberName == nameof(Nullable.Value) || memberName == nameof(Nullable.HasValue)));
+ && callerType.GetGenericTypeDefinition() == typeof(Nullable<>)
+ && (memberName == nameof(Nullable.Value) || memberName == nameof(Nullable.HasValue)));
var updatedMemberExpression = (Expression)memberExpression.Update(innerExpression);
if (innerExpression != null
@@ -202,8 +206,8 @@ private bool TryBindMember(Expression source, MemberIdentity memberIdentity, Typ
// if the result type change was just nullability change e.g from int to int? we want to preserve the new type for null propagation
if (result.Type != type
&& !(result.Type.IsNullableType()
- && !type.IsNullableType()
- && result.Type.UnwrapNullableType() == type))
+ && !type.IsNullableType()
+ && result.Type.UnwrapNullableType() == type))
{
result = Expression.Convert(result, type);
}
@@ -216,18 +220,18 @@ private bool TryBindMember(Expression source, MemberIdentity memberIdentity, Typ
private static bool IsConvertedToNullable(Expression result, Expression original)
=> result.Type.IsNullableType()
- && !original.Type.IsNullableType()
- && result.Type.UnwrapNullableType() == original.Type;
+ && !original.Type.IsNullableType()
+ && result.Type.UnwrapNullableType() == original.Type;
private static Expression ConvertToNullable(Expression expression)
=> !expression.Type.IsNullableType()
- ? Expression.Convert(expression, expression.Type.MakeNullable())
- : expression;
+ ? Expression.Convert(expression, expression.Type.MakeNullable())
+ : expression;
private static Expression ConvertToNonNullable(Expression expression)
=> expression.Type.IsNullableType()
- ? Expression.Convert(expression, expression.Type.UnwrapNullableType())
- : expression;
+ ? Expression.Convert(expression, expression.Type.UnwrapNullableType())
+ : expression;
private static Expression BindProperty(EntityProjectionExpression entityProjectionExpression, IProperty property)
=> entityProjectionExpression.BindProperty(property);
@@ -315,7 +319,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
? method.MakeGenericMethod(typeof(ValueBuffer), selector.ReturnType)
: method.MakeGenericMethod(typeof(ValueBuffer));
- return Expression.Call(method,
+ return Expression.Call(
+ method,
groupByShaperExpression.GroupingParameter,
selector);
@@ -339,8 +344,8 @@ MethodInfo GetMethod()
{
return Expression.Call(
(countMethod
- ? InMemoryLinqOperatorProvider.CountWithoutPredicate
- : InMemoryLinqOperatorProvider.LongCountWithoutPredicate)
+ ? InMemoryLinqOperatorProvider.CountWithoutPredicate
+ : InMemoryLinqOperatorProvider.LongCountWithoutPredicate)
.MakeGenericMethod(typeof(ValueBuffer)),
groupByShaperExpression.GroupingParameter);
}
@@ -355,8 +360,8 @@ MethodInfo GetMethod()
return Expression.Call(
(countMethod
- ? InMemoryLinqOperatorProvider.CountWithPredicate
- : InMemoryLinqOperatorProvider.LongCountWithPredicate)
+ ? InMemoryLinqOperatorProvider.CountWithPredicate
+ : InMemoryLinqOperatorProvider.LongCountWithPredicate)
.MakeGenericMethod(typeof(ValueBuffer)),
groupByShaperExpression.GroupingParameter,
predicate);
@@ -383,8 +388,6 @@ MethodInfo GetMethod()
return null;
}
- Expression result;
-
// Unwrap ResultEnumerable
var selectMethod = (MethodCallExpression)subquery.ServerQueryExpression;
var resultEnumerable = (NewExpression)selectMethod.Arguments[0];
@@ -392,6 +395,7 @@ MethodInfo GetMethod()
// New ValueBuffer construct
if (resultFunc is NewExpression newValueBufferExpression)
{
+ Expression result;
var innerExpression = ((NewArrayExpression)newValueBufferExpression.Arguments[0]).Expressions[0];
if (innerExpression is UnaryExpression unaryExpression
&& innerExpression.NodeType == ExpressionType.Convert
@@ -565,6 +569,7 @@ protected override Expression VisitNewArray(NewArrayExpression newArrayExpressio
{
return null;
}
+
if (IsConvertedToNullable(newExpression, expression))
{
newExpression = ConvertToNonNullable(newExpression);
@@ -583,6 +588,7 @@ protected override MemberAssignment VisitMemberAssignment(MemberAssignment membe
{
return null;
}
+
if (IsConvertedToNullable(expression, memberAssignment.Expression))
{
expression = ConvertToNonNullable(expression);
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryLinqOperatorProvider.cs b/src/EFCore.InMemory/Query/Internal/InMemoryLinqOperatorProvider.cs
index cf0c734b2ba..451ef7a2f4c 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryLinqOperatorProvider.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryLinqOperatorProvider.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using Microsoft.EntityFrameworkCore.Utilities;
namespace Microsoft.EntityFrameworkCore.InMemory.Query.Internal
{
@@ -76,6 +75,7 @@ public static class InMemoryLinqOperatorProvider
public static MethodInfo GetAverageWithoutSelector(Type type) => AverageWithoutSelectorMethods[type];
public static MethodInfo GetAverageWithSelector(Type type) => AverageWithSelectorMethods[type];
+
public static MethodInfo GetMaxWithoutSelector(Type type)
=> MaxWithoutSelectorMethods.TryGetValue(type, out var method)
? method
@@ -119,9 +119,10 @@ private static Type GetFuncType(int funcGenericArguments)
_ => throw new InvalidOperationException("Invalid number of arguments for Func"),
};
}
+
private static bool IsFunc(Type type, int funcGenericArguments = 2)
=> type.IsGenericType
- && type.GetGenericTypeDefinition() == GetFuncType(funcGenericArguments);
+ && type.GetGenericTypeDefinition() == GetFuncType(funcGenericArguments);
static InMemoryLinqOperatorProvider()
{
@@ -160,15 +161,20 @@ static InMemoryLinqOperatorProvider()
LongCountWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.LongCount) && mi.GetParameters().Length == 1);
LongCountWithPredicate = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.LongCount) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.LongCount) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
MinWithSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Min) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 2 && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.Min) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 2
+ && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
MinWithoutSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Min) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 1 && mi.GetParameters().Length == 1);
+ mi => mi.Name == nameof(Enumerable.Min) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 1
+ && mi.GetParameters().Length == 1);
MaxWithSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Max) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 2 && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.Max) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 2
+ && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
MaxWithoutSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Max) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 1 && mi.GetParameters().Length == 1);
+ mi => mi.Name == nameof(Enumerable.Max) && mi.IsGenericMethod && mi.GetGenericArguments().Length == 1
+ && mi.GetParameters().Length == 1);
ElementAt = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.ElementAt) && mi.GetParameters().Length == 2);
@@ -181,15 +187,18 @@ static InMemoryLinqOperatorProvider()
FirstOrDefaultWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.FirstOrDefault) && mi.GetParameters().Length == 1);
FirstOrDefaultWithPredicate = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.FirstOrDefault) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.FirstOrDefault) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
SingleWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Single) && mi.GetParameters().Length == 1);
SingleWithPredicate = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Single) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.Single) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
SingleOrDefaultWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.SingleOrDefault) && mi.GetParameters().Length == 1);
SingleOrDefaultWithPredicate = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.SingleOrDefault) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.SingleOrDefault) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
LastWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Last) && mi.GetParameters().Length == 1);
LastWithPredicate = enumerableMethods.Single(
@@ -197,7 +206,8 @@ static InMemoryLinqOperatorProvider()
LastOrDefaultWithoutPredicate = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.LastOrDefault) && mi.GetParameters().Length == 1);
LastOrDefaultWithPredicate = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.LastOrDefault) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.LastOrDefault) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
Distinct = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Distinct) && mi.GetParameters().Length == 1);
@@ -206,23 +216,30 @@ static InMemoryLinqOperatorProvider()
Where = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Where) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
Select = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.Select) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.Select) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
Skip = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Skip) && mi.GetParameters().Length == 2);
Take = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.Take) && mi.GetParameters().Length == 2);
SkipWhile = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.SkipWhile) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.SkipWhile) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
TakeWhile = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.TakeWhile) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.TakeWhile) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
OrderBy = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.OrderBy) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.OrderBy) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
OrderByDescending = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.OrderByDescending) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.OrderByDescending) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
ThenBy = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.ThenBy) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.ThenBy) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
ThenByDescending = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.ThenByDescending) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.ThenByDescending) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
DefaultIfEmptyWithoutArgument = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.DefaultIfEmpty) && mi.GetParameters().Length == 1);
DefaultIfEmptyWithArgument = enumerableMethods.Single(
@@ -233,18 +250,24 @@ static InMemoryLinqOperatorProvider()
GroupJoin = enumerableMethods.Single(
mi => mi.Name == nameof(Enumerable.GroupJoin) && mi.GetParameters().Length == 5);
SelectManyWithCollectionSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.SelectMany) && mi.GetParameters().Length == 3 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.SelectMany) && mi.GetParameters().Length == 3
+ && IsFunc(mi.GetParameters()[1].ParameterType));
SelectManyWithoutCollectionSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.SelectMany) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.SelectMany) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
GroupByWithKeySelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 2 && IsFunc(mi.GetParameters()[1].ParameterType));
+ mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 2
+ && IsFunc(mi.GetParameters()[1].ParameterType));
GroupByWithKeyElementSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 3 && IsFunc(mi.GetParameters()[1].ParameterType) && IsFunc(mi.GetParameters()[2].ParameterType));
+ mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 3 && IsFunc(mi.GetParameters()[1].ParameterType)
+ && IsFunc(mi.GetParameters()[2].ParameterType));
GroupByWithKeyElementResultSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 4 && IsFunc(mi.GetParameters()[1].ParameterType) && IsFunc(mi.GetParameters()[2].ParameterType) && IsFunc(mi.GetParameters()[3].ParameterType, 3));
+ mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 4 && IsFunc(mi.GetParameters()[1].ParameterType)
+ && IsFunc(mi.GetParameters()[2].ParameterType) && IsFunc(mi.GetParameters()[3].ParameterType, 3));
GroupByWithKeyResultSelector = enumerableMethods.Single(
- mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 3 && IsFunc(mi.GetParameters()[1].ParameterType) && IsFunc(mi.GetParameters()[2].ParameterType, 3));
+ mi => mi.Name == nameof(Enumerable.GroupBy) && mi.GetParameters().Length == 3 && IsFunc(mi.GetParameters()[1].ParameterType)
+ && IsFunc(mi.GetParameters()[2].ParameterType, 3));
MethodInfo getSumOrAverageWithoutSelector(string methodName)
=> enumerableMethods.Single(
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
index 7e86283543f..aa400820078 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs
@@ -141,7 +141,8 @@ public override Expression Visit(Expression expression)
translation = NullSafeConvert(translation, expression.Type);
}
- return new ProjectionBindingExpression(_queryExpression, _queryExpression.AddToProjection(translation), expression.Type);
+ return new ProjectionBindingExpression(
+ _queryExpression, _queryExpression.AddToProjection(translation), expression.Type);
}
else
{
@@ -204,13 +205,11 @@ protected override Expression VisitExtension(Expression extensionExpression)
return entityShaperExpression.Update(
new ProjectionBindingExpression(_queryExpression, _queryExpression.AddToProjection(entityProjectionExpression)));
}
- else
- {
- _projectionMapping[_projectionMembers.Peek()] = entityProjectionExpression;
- return entityShaperExpression.Update(
- new ProjectionBindingExpression(_queryExpression, _projectionMembers.Peek(), typeof(ValueBuffer)));
- }
+ _projectionMapping[_projectionMembers.Peek()] = entityProjectionExpression;
+
+ return entityShaperExpression.Update(
+ new ProjectionBindingExpression(_queryExpression, _projectionMembers.Peek(), typeof(ValueBuffer)));
}
if (extensionExpression is IncludeExpression includeExpression)
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
index 504c13d1e01..b7c043877e7 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryQueryExpression.cs
@@ -17,12 +17,15 @@ public partial class InMemoryQueryExpression : Expression, IPrintableExpression
{
private static readonly ConstructorInfo _valueBufferConstructor
= typeof(ValueBuffer).GetConstructors().Single(ci => ci.GetParameters().Length == 1);
+
private static readonly PropertyInfo _valueBufferCountMemberInfo
= typeof(ValueBuffer).GetTypeInfo().GetProperty(nameof(ValueBuffer.Count));
private readonly List _valueBufferSlots = new List();
+
private readonly IDictionary> _entityProjectionCache
= new Dictionary>();
+
private readonly ParameterExpression _valueBufferParameter;
private IDictionary _projectionMapping = new Dictionary();
@@ -49,7 +52,8 @@ public InMemoryQueryExpression(IEntityType entityType)
readExpressionMap[property] = Condition(
LessThan(
Constant(property.GetIndex()),
- MakeMemberAccess(_valueBufferParameter,
+ MakeMemberAccess(
+ _valueBufferParameter,
_valueBufferCountMemberInfo)),
CreateReadValueExpression(property.ClrType, property.GetIndex(), property),
Default(property.ClrType));
@@ -138,7 +142,8 @@ public virtual int AddSubqueryProjection(ShapedQueryExpression shapedQueryExpres
if (serverQueryExpression is MethodCallExpression selectMethodCall
&& selectMethodCall.Arguments[0].Type == typeof(ResultEnumerable))
{
- var terminatingMethodCall = (MethodCallExpression)((LambdaExpression)((NewExpression)selectMethodCall.Arguments[0]).Arguments[0]).Body;
+ var terminatingMethodCall =
+ (MethodCallExpression)((LambdaExpression)((NewExpression)selectMethodCall.Arguments[0]).Arguments[0]).Body;
selectMethodCall = selectMethodCall.Update(
null, new[] { terminatingMethodCall.Arguments[0], selectMethodCall.Arguments[1] });
serverQueryExpression = terminatingMethodCall.Update(null, new[] { selectMethodCall });
@@ -171,15 +176,14 @@ public override Expression Visit(Expression expression)
{
return new ProjectionBindingExpression(projectionBindingExpression.QueryExpression, indexMap);
}
- else if (mappingValue is int index)
+
+ if (mappingValue is int index)
{
return new ProjectionBindingExpression(
projectionBindingExpression.QueryExpression, index, projectionBindingExpression.Type);
}
- else
- {
- throw new InvalidOperationException("Invalid ProjectionMapping.");
- }
+
+ throw new InvalidOperationException("Invalid ProjectionMapping.");
}
return base.Visit(expression);
@@ -209,6 +213,7 @@ public virtual void PushdownIntoSubquery()
var index = AddToProjection(expressionToAdd);
map[property] = CreateReadValueExpression(expressionToAdd.Type, index, property);
}
+
result[keyValuePair.Key] = new EntityProjectionExpression(entityProjection.EntityType, map);
}
else
@@ -272,6 +277,7 @@ public virtual void ApplyDefaultIfEmpty()
var index = AddToProjection(expressionToAdd);
map[property] = CreateReadValueExpression(expressionToAdd.Type.MakeNullable(), index, property);
}
+
result[keyValuePair.Key] = new EntityProjectionExpression(entityProjection.EntityType, map);
}
else
@@ -334,6 +340,7 @@ public virtual void ApplyProjection()
{
map[property] = AddToProjection(entityProjection.BindProperty(property));
}
+
result[keyValuePair.Key] = Constant(map);
}
else
@@ -381,11 +388,11 @@ public virtual InMemoryGroupByShaperExpression ApplyGrouping(Expression grouping
_valueBufferParameter);
ServerQueryExpression = Call(
- InMemoryLinqOperatorProvider.GroupByWithKeyElementSelector.MakeGenericMethod(
- typeof(ValueBuffer), typeof(ValueBuffer), typeof(ValueBuffer)),
- selectMethod.Arguments[0],
- keySelector,
- selectMethod.Arguments[1]);
+ InMemoryLinqOperatorProvider.GroupByWithKeyElementSelector.MakeGenericMethod(
+ typeof(ValueBuffer), typeof(ValueBuffer), typeof(ValueBuffer)),
+ selectMethod.Arguments[0],
+ keySelector,
+ selectMethod.Arguments[1]);
return new InMemoryGroupByShaperExpression(
groupingKey,
@@ -410,6 +417,7 @@ private Expression GetGroupingKey(Expression key, List groupingExpre
{
arguments[i] = GetGroupingKey(newExpression.Arguments[i], groupingExpressions, groupingKeyAccessExpression);
}
+
return newExpression.Update(arguments);
case MemberInitExpression memberInitExpression:
@@ -430,6 +438,7 @@ private Expression GetGroupingKey(Expression key, List groupingExpre
groupingExpressions,
groupingKeyAccessExpression));
}
+
return memberInitExpression.Update(updatedNewExpression, memberBindings);
default:
@@ -465,11 +474,10 @@ public virtual void AddInnerJoin(
var resultValueBufferExpressions = new List();
var projectionMapping = new Dictionary();
var replacingVisitor = new ReplacingExpressionVisitor(
- new Dictionary
- {
- { CurrentParameter, outerParameter },
- { innerQueryExpression.CurrentParameter, innerParameter }
- });
+ new Dictionary
+ {
+ { CurrentParameter, outerParameter }, { innerQueryExpression.CurrentParameter, innerParameter }
+ });
var index = 0;
var outerMemberInfo = transparentIdentifierType.GetTypeInfo().GetDeclaredField("Outer");
@@ -581,11 +589,11 @@ public virtual void AddLeftJoin(
var resultValueBufferExpressions = new List();
var projectionMapping = new Dictionary();
var replacingVisitor = new ReplacingExpressionVisitor(
- new Dictionary
- {
- { CurrentParameter, MakeMemberAccess(outerParameter, outerMemberInfo) },
- { innerQueryExpression.CurrentParameter, innerParameter }
- });
+ new Dictionary
+ {
+ { CurrentParameter, MakeMemberAccess(outerParameter, outerMemberInfo) },
+ { innerQueryExpression.CurrentParameter, innerParameter }
+ });
var index = 0;
outerMemberInfo = transparentIdentifierType.GetTypeInfo().GetDeclaredField("Outer");
@@ -681,11 +689,10 @@ public virtual void AddSelectMany(InMemoryQueryExpression innerQueryExpression,
var resultValueBufferExpressions = new List();
var projectionMapping = new Dictionary();
var replacingVisitor = new ReplacingExpressionVisitor(
- new Dictionary
- {
- { CurrentParameter, outerParameter },
- { innerQueryExpression.CurrentParameter, innerParameter }
- });
+ new Dictionary
+ {
+ { CurrentParameter, outerParameter }, { innerQueryExpression.CurrentParameter, innerParameter }
+ });
var index = 0;
var outerMemberInfo = transparentIdentifierType.GetTypeInfo().GetDeclaredField("Outer");
@@ -726,6 +733,7 @@ public virtual void AddSelectMany(InMemoryQueryExpression innerQueryExpression,
{
replacedExpression = nullableReadValueExpressionVisitor.Visit(replacedExpression);
}
+
resultValueBufferExpressions.Add(replacedExpression);
readExpressionMap[property] = CreateReadValueExpression(replacedExpression.Type, index++, property);
}
@@ -740,6 +748,7 @@ public virtual void AddSelectMany(InMemoryQueryExpression innerQueryExpression,
{
replacedExpression = nullableReadValueExpressionVisitor.Visit(replacedExpression);
}
+
resultValueBufferExpressions.Add(replacedExpression);
projectionMapping[projection.Key.Prepend(innerMemberInfo)]
= CreateReadValueExpression(replacedExpression.Type, index++, InferPropertyFromInner(projection.Value));
@@ -784,8 +793,7 @@ public virtual EntityShaperExpression AddNavigationToWeakEntityType(
var resultSelector = Lambda(
New(
groupTransparentIdentifierType.GetTypeInfo().DeclaredConstructors.Single(),
- new[] { outerParameter, innerParameter },
- new[] { outerMemberInfo, innerMemberInfo }),
+ new[] { outerParameter, innerParameter }, outerMemberInfo, innerMemberInfo),
outerParameter,
innerParameter);
@@ -832,7 +840,7 @@ EntityProjectionExpression copyEntityProjectionToOuter(EntityProjectionExpressio
// Also lift nested entity projections
foreach (var navigation in entityProjection.EntityType.GetTypesInHierarchy()
- .SelectMany(EntityTypeExtensions.GetDeclaredNavigations))
+ .SelectMany(EntityTypeExtensions.GetDeclaredNavigations))
{
var boundEntityShaperExpression = entityProjection.BindNavigation(navigation);
if (boundEntityShaperExpression != null)
@@ -876,6 +884,7 @@ EntityProjectionExpression copyEntityProjectionToOuter(EntityProjectionExpressio
resultValueBufferExpressions.Add(replacedExpression);
innerReadExpressionMap[property] = CreateReadValueExpression(replacedExpression.Type, index++, property);
}
+
innerEntityProjection = new EntityProjectionExpression(innerEntityProjection.EntityType, innerReadExpressionMap);
var collectionSelector = Lambda(
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
index a621712b7af..d05c5b9b19d 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryQueryableMethodTranslatingExpressionVisitor.cs
@@ -233,7 +233,8 @@ protected override ShapedQueryExpression TranslateFirstOrDefault(
: InMemoryLinqOperatorProvider.FirstWithoutPredicate);
}
- protected override ShapedQueryExpression TranslateGroupBy(ShapedQueryExpression source, LambdaExpression keySelector, LambdaExpression elementSelector, LambdaExpression resultSelector)
+ protected override ShapedQueryExpression TranslateGroupBy(
+ ShapedQueryExpression source, LambdaExpression keySelector, LambdaExpression elementSelector, LambdaExpression resultSelector)
{
var remappedKeySelector = RemapLambdaBody(source, keySelector);
@@ -257,7 +258,8 @@ protected override ShapedQueryExpression TranslateGroupBy(ShapedQueryExpression
var original2 = resultSelector.Parameters[1];
var newResultSelectorBody = new ReplacingExpressionVisitor(
- new Dictionary {
+ new Dictionary
+ {
{ original1, ((GroupByShaperExpression)source.ShaperExpression).KeySelector },
{ original2, source.ShaperExpression }
}).Visit(resultSelector.Body);
@@ -332,7 +334,7 @@ private Expression TranslateGroupingKey(Expression expression)
}
return translation.Type == expression.Type
- ? (Expression)translation
+ ? translation
: Expression.Convert(translation, expression.Type);
}
}
@@ -351,7 +353,8 @@ protected override ShapedQueryExpression TranslateJoin(
{
outerKeySelector = TranslateLambdaExpression(outer, outerKeySelector);
innerKeySelector = TranslateLambdaExpression(inner, innerKeySelector);
- if (outerKeySelector == null || innerKeySelector == null)
+ if (outerKeySelector == null
+ || innerKeySelector == null)
{
return null;
}
@@ -380,8 +383,8 @@ private static (LambdaExpression OuterKeySelector, LambdaExpression InnerKeySele
{
static bool isConvertedToNullable(Expression outer, Expression inner)
=> outer.Type.IsNullableType()
- && !inner.Type.IsNullableType()
- && outer.Type.UnwrapNullableType() == inner.Type;
+ && !inner.Type.IsNullableType()
+ && outer.Type.UnwrapNullableType() == inner.Type;
if (outerKeySelector.Body.Type != innerKeySelector.Body.Type)
{
@@ -400,7 +403,8 @@ static bool isConvertedToNullable(Expression outer, Expression inner)
return (outerKeySelector, innerKeySelector);
}
- protected override ShapedQueryExpression TranslateLastOrDefault(ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
+ protected override ShapedQueryExpression TranslateLastOrDefault(
+ ShapedQueryExpression source, LambdaExpression predicate, Type returnType, bool returnDefault)
{
return TranslateSingleResultOperator(
source,
@@ -417,7 +421,8 @@ protected override ShapedQueryExpression TranslateLeftJoin(
{
outerKeySelector = TranslateLambdaExpression(outer, outerKeySelector);
innerKeySelector = TranslateLambdaExpression(inner, innerKeySelector);
- if (outerKeySelector == null || innerKeySelector == null)
+ if (outerKeySelector == null
+ || innerKeySelector == null)
{
return null;
}
@@ -449,7 +454,8 @@ protected override ShapedQueryExpression TranslateLongCount(ShapedQueryExpressio
{
inMemoryQueryExpression.ServerQueryExpression =
Expression.Call(
- InMemoryLinqOperatorProvider.LongCountWithoutPredicate.MakeGenericMethod(inMemoryQueryExpression.CurrentParameter.Type),
+ InMemoryLinqOperatorProvider.LongCountWithoutPredicate.MakeGenericMethod(
+ inMemoryQueryExpression.CurrentParameter.Type),
inMemoryQueryExpression.ServerQueryExpression);
}
else
@@ -462,7 +468,8 @@ protected override ShapedQueryExpression TranslateLongCount(ShapedQueryExpressio
inMemoryQueryExpression.ServerQueryExpression =
Expression.Call(
- InMemoryLinqOperatorProvider.LongCountWithPredicate.MakeGenericMethod(inMemoryQueryExpression.CurrentParameter.Type),
+ InMemoryLinqOperatorProvider.LongCountWithPredicate.MakeGenericMethod(
+ inMemoryQueryExpression.CurrentParameter.Type),
inMemoryQueryExpression.ServerQueryExpression,
predicate);
}
@@ -540,7 +547,7 @@ protected override ShapedQueryExpression TranslateOfType(ShapedQueryExpression s
inMemoryQueryExpression.ReplaceProjectionMapping(
new Dictionary
{
- { projectionMember, entityProjection.UpdateEntityType(derivedType)}
+ { projectionMember, entityProjection.UpdateEntityType(derivedType) }
});
source.ShaperExpression = entityShaperExpression.WithEntityType(derivedType);
@@ -657,12 +664,7 @@ protected override ShapedQueryExpression TranslateSelectMany(ShapedQueryExpressi
{
var innerParameter = Expression.Parameter(selector.ReturnType.TryGetSequenceType(), "i");
var resultSelector = Expression.Lambda(
- innerParameter,
- new[]
- {
- Expression.Parameter(source.Type.TryGetSequenceType()),
- innerParameter
- });
+ innerParameter, Expression.Parameter(source.Type.TryGetSequenceType()), innerParameter);
return TranslateSelectMany(source, selector, resultSelector);
}
@@ -736,7 +738,7 @@ protected override ShapedQueryExpression TranslateThenBy(ShapedQueryExpression s
inMemoryQueryExpression.ServerQueryExpression
= Expression.Call(
(ascending ? InMemoryLinqOperatorProvider.ThenBy : InMemoryLinqOperatorProvider.ThenByDescending)
- .MakeGenericMethod(inMemoryQueryExpression.CurrentParameter.Type, keySelector.ReturnType),
+ .MakeGenericMethod(inMemoryQueryExpression.CurrentParameter.Type, keySelector.ReturnType),
inMemoryQueryExpression.ServerQueryExpression,
keySelector);
@@ -767,8 +769,10 @@ private Expression TranslateExpression(Expression expression, bool preserveType
{
var result = _expressionTranslator.Translate(expression);
- if (expression != null && result != null
- && preserveType && expression.Type != result.Type)
+ if (expression != null
+ && result != null
+ && preserveType
+ && expression.Type != result.Type)
{
result = expression.Type == typeof(bool)
? Expression.Equal(result, Expression.Constant(true, result.Type))
@@ -786,7 +790,8 @@ private LambdaExpression TranslateLambdaExpression(
var lambdaBody = TranslateExpression(RemapLambdaBody(shapedQueryExpression, lambdaExpression), preserveType);
return lambdaBody != null
- ? Expression.Lambda(lambdaBody,
+ ? Expression.Lambda(
+ lambdaBody,
((InMemoryQueryExpression)shapedQueryExpression.QueryExpression).CurrentParameter)
: null;
}
@@ -845,8 +850,8 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
source = Visit(source);
if (source is EntityShaperExpression
|| (source is UnaryExpression innerUnaryExpression
- && innerUnaryExpression.NodeType == ExpressionType.Convert
- && innerUnaryExpression.Operand is EntityShaperExpression))
+ && innerUnaryExpression.NodeType == ExpressionType.Convert
+ && innerUnaryExpression.Operand is EntityShaperExpression))
{
var collectionNavigation = Expand(source, MemberIdentity.Create(navigationName));
if (collectionNavigation != null)
@@ -983,7 +988,8 @@ ProjectionBindingExpression projectionBindingExpression
makeNullable);
var outerKeySelector = Expression.Lambda(_expressionTranslator.Translate(outerKey), _queryExpression.CurrentParameter);
- var innerKeySelector = Expression.Lambda(_expressionTranslator.Translate(innerKey), innerQueryExpression.CurrentParameter);
+ var innerKeySelector = Expression.Lambda(
+ _expressionTranslator.Translate(innerKey), innerQueryExpression.CurrentParameter);
(outerKeySelector, innerKeySelector) = AlignKeySelectorTypes(outerKeySelector, innerKeySelector);
innerShaper = _queryExpression.AddNavigationToWeakEntityType(
entityProjectionExpression, navigation, innerQueryExpression, outerKeySelector, innerKeySelector);
@@ -1019,13 +1025,15 @@ MethodInfo getMethod()
nameof(Enumerable.Sum) => InMemoryLinqOperatorProvider.GetSumWithSelector(selector.ReturnType),
_ => throw new InvalidOperationException("Invalid Aggregate Operator encountered."),
};
+
var method = getMethod();
method = method.GetGenericArguments().Length == 2
? method.MakeGenericMethod(typeof(ValueBuffer), selector.ReturnType)
: method.MakeGenericMethod(typeof(ValueBuffer));
inMemoryQueryExpression.ServerQueryExpression
- = Expression.Call(method,
+ = Expression.Call(
+ method,
inMemoryQueryExpression.ServerQueryExpression,
selector);
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.CustomShaperCompilingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.CustomShaperCompilingExpressionVisitor.cs
index fa2bcbae860..550daa5c419 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.CustomShaperCompilingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.CustomShaperCompilingExpressionVisitor.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
index 6895b4f6d1a..de205ddcc01 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.InMemoryProjectionBindingRemovingExpressionVisitor.cs
@@ -17,7 +17,7 @@ private class InMemoryProjectionBindingRemovingExpressionVisitor : ExpressionVis
{
private readonly IDictionary IndexMap, ParameterExpression valueBuffer)>
_materializationContextBindings
- = new Dictionary IndexMap, ParameterExpression valueBuffer)>();
+ = new Dictionary IndexMap, ParameterExpression valueBuffer)>();
protected override Expression VisitBinary(BinaryExpression binaryExpression)
{
@@ -103,7 +103,8 @@ private IPropertyBase InferPropertyFromInner(Expression expression)
return null;
}
- private object GetProjectionIndex(InMemoryQueryExpression queryExpression, ProjectionBindingExpression projectionBindingExpression)
+ private object GetProjectionIndex(
+ InMemoryQueryExpression queryExpression, ProjectionBindingExpression projectionBindingExpression)
{
return projectionBindingExpression.ProjectionMember != null
? ((ConstantExpression)queryExpression.GetMappedProjection(projectionBindingExpression.ProjectionMember)).Value
diff --git a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
index 980062f54fd..3a77fc27b7d 100644
--- a/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/InMemoryShapedQueryCompilingExpressionVisitor.cs
@@ -50,7 +50,7 @@ protected override Expression VisitShapedQueryExpression(ShapedQueryExpression s
var inMemoryQueryExpression = (InMemoryQueryExpression)shapedQueryExpression.QueryExpression;
var shaper = new ShaperExpressionProcessingExpressionVisitor(
- inMemoryQueryExpression, inMemoryQueryExpression.CurrentParameter)
+ inMemoryQueryExpression, inMemoryQueryExpression.CurrentParameter)
.Inject(shapedQueryExpression.ShaperExpression);
shaper = InjectEntityMaterializers(shaper);
diff --git a/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs b/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
index 688007a71c2..b935738cae7 100644
--- a/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
+++ b/src/EFCore.InMemory/Query/Internal/ShaperExpressionProcessingExpressionVisitor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
-using System.Linq;
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;
@@ -147,7 +146,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
private Expression GenerateKey(ProjectionBindingExpression projectionBindingExpression)
=> _queryExpression != null
- && projectionBindingExpression.ProjectionMember != null
+ && projectionBindingExpression.ProjectionMember != null
? _queryExpression.GetMappedProjection(projectionBindingExpression.ProjectionMember)
: projectionBindingExpression;
}
diff --git a/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs b/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
index db4e3a291a1..d8c3ce1089e 100644
--- a/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
+++ b/src/EFCore.InMemory/Query/Internal/SingleResultShaperExpression.cs
@@ -47,7 +47,7 @@ public virtual void Print(ExpressionPrinter expressionPrinter)
expressionPrinter.Visit(Projection);
expressionPrinter.Append(", ");
expressionPrinter.Visit(InnerShaper);
- expressionPrinter.AppendLine($")");
+ expressionPrinter.AppendLine(")");
}
}
}
diff --git a/src/EFCore.Relational/Diagnostics/DbTransactionInterceptor.cs b/src/EFCore.Relational/Diagnostics/DbTransactionInterceptor.cs
index f54fb0118fa..e1d51a719f0 100644
--- a/src/EFCore.Relational/Diagnostics/DbTransactionInterceptor.cs
+++ b/src/EFCore.Relational/Diagnostics/DbTransactionInterceptor.cs
@@ -67,7 +67,8 @@ public virtual DbTransaction TransactionStarted(
=> result;
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The connection.
/// Contextual information about connection and transaction.
@@ -92,7 +93,8 @@ public virtual Task> TransactionStartingAsync(
///
///
- /// Called immediately after EF calls .
+ /// Called immediately after EF calls
+ /// .
///
///
/// This method is still called if an interceptor suppressed creation in .
@@ -102,7 +104,8 @@ public virtual Task> TransactionStartingAsync(
/// The connection.
/// Contextual information about connection and transaction.
///
- /// The result of the call to .
+ /// The result of the call to
+ /// .
/// This value is typically used as the return value for the implementation of this method.
///
/// The cancellation token.
@@ -198,7 +201,8 @@ public virtual void TransactionCommitted(
}
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The transaction.
/// Contextual information about connection and transaction.
@@ -272,7 +276,8 @@ public virtual void TransactionRolledBack(
}
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The transaction.
/// Contextual information about connection and transaction.
diff --git a/src/EFCore.Relational/Diagnostics/IDbTransactionInterceptor.cs b/src/EFCore.Relational/Diagnostics/IDbTransactionInterceptor.cs
index 8092a7e437f..a4764a7b90a 100644
--- a/src/EFCore.Relational/Diagnostics/IDbTransactionInterceptor.cs
+++ b/src/EFCore.Relational/Diagnostics/IDbTransactionInterceptor.cs
@@ -81,7 +81,8 @@ DbTransaction TransactionStarted(
[CanBeNull] DbTransaction result);
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The connection.
/// Contextual information about connection and transaction.
@@ -107,7 +108,8 @@ Task> TransactionStartingAsync(
///
///
- /// Called immediately after EF calls .
+ /// Called immediately after EF calls
+ /// .
///
///
/// This method is still called if an interceptor suppressed creation in .
@@ -117,7 +119,8 @@ Task> TransactionStartingAsync(
/// The connection.
/// Contextual information about connection and transaction.
///
- /// The result of the call to .
+ /// The result of the call to
+ /// .
/// This value is typically used as the return value for the implementation of this method.
///
/// The cancellation token.
@@ -210,7 +213,8 @@ void TransactionCommitted(
[NotNull] TransactionEndEventData eventData);
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The transaction.
/// Contextual information about connection and transaction.
@@ -279,7 +283,8 @@ void TransactionRolledBack(
[NotNull] TransactionEndEventData eventData);
///
- /// Called just before EF intends to call .
+ /// Called just before EF intends to call
+ /// .
///
/// The transaction.
/// Contextual information about connection and transaction.
diff --git a/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs b/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs
index f17c429d226..3e3f2c16e33 100644
--- a/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs
+++ b/src/EFCore.Relational/Metadata/Builders/DbFunctionParameterBuilder.cs
@@ -71,8 +71,8 @@ IConventionDbFunctionParameterBuilder IConventionDbFunctionParameterBuilder.HasS
///
bool IConventionDbFunctionParameterBuilder.CanSetStoreType(string storeType, bool fromDataAnnotation)
- => Overrides(fromDataAnnotation, _parameter.GetStoreTypeConfigurationSource())
- || _parameter.StoreType == storeType;
+ => Overrides(fromDataAnnotation, _parameter.GetStoreTypeConfigurationSource())
+ || _parameter.StoreType == storeType;
///
IConventionDbFunctionParameterBuilder IConventionDbFunctionParameterBuilder.HasTypeMapping(
@@ -89,8 +89,8 @@ IConventionDbFunctionParameterBuilder IConventionDbFunctionParameterBuilder.HasT
///
bool IConventionDbFunctionParameterBuilder.CanSetTypeMapping(RelationalTypeMapping typeMapping, bool fromDataAnnotation)
- => Overrides(fromDataAnnotation, _parameter.GetTypeMappingConfigurationSource())
- || _parameter.TypeMapping == typeMapping;
+ => Overrides(fromDataAnnotation, _parameter.GetTypeMappingConfigurationSource())
+ || _parameter.TypeMapping == typeMapping;
private bool Overrides(bool fromDataAnnotation, ConfigurationSource? configurationSource)
=> (fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention)
diff --git a/src/EFCore.Relational/Metadata/Conventions/RelationalValueGenerationConvention.cs b/src/EFCore.Relational/Metadata/Conventions/RelationalValueGenerationConvention.cs
index 7cb7d1586c4..338356ca05b 100644
--- a/src/EFCore.Relational/Metadata/Conventions/RelationalValueGenerationConvention.cs
+++ b/src/EFCore.Relational/Metadata/Conventions/RelationalValueGenerationConvention.cs
@@ -76,7 +76,8 @@ public virtual void ProcessEntityTypeAnnotationChanged(
entityTypeBuilder,
(string)oldAnnotation?.Value ?? entityTypeBuilder.Metadata.GetDefaultTableName(),
entityTypeBuilder.Metadata.GetSchema());
- } else if (name == RelationalAnnotationNames.Schema)
+ }
+ else if (name == RelationalAnnotationNames.Schema)
{
ProcessTableChanged(
entityTypeBuilder,
diff --git a/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs b/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs
index c30bd156efd..4e8f10aaa36 100644
--- a/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs
+++ b/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs
@@ -32,19 +32,32 @@ namespace Microsoft.EntityFrameworkCore.Migrations.Internal
/// doing so can result in application failures when updating to a new Entity Framework Core release.
///
///
- /// The service lifetime is . This means that each
- /// instance will use its own instance of this service.
+ /// The service lifetime is . This means that each
+ /// instance will use its own instance of this service.
/// The implementation may depend on other services registered with any lifetime.
/// The implementation does not need to be thread-safe.
///
///
public class MigrationsModelDiffer : IMigrationsModelDiffer
{
- private static readonly Type[] _dropOperationTypes = { typeof(DropIndexOperation), typeof(DropPrimaryKeyOperation), typeof(DropSequenceOperation), typeof(DropUniqueConstraintOperation), typeof(DropCheckConstraintOperation) };
-
- private static readonly Type[] _alterOperationTypes = { typeof(AddPrimaryKeyOperation), typeof(AddUniqueConstraintOperation), typeof(AlterSequenceOperation) };
+ private static readonly Type[] _dropOperationTypes =
+ {
+ typeof(DropIndexOperation),
+ typeof(DropPrimaryKeyOperation),
+ typeof(DropSequenceOperation),
+ typeof(DropUniqueConstraintOperation),
+ typeof(DropCheckConstraintOperation)
+ };
+
+ private static readonly Type[] _alterOperationTypes =
+ {
+ typeof(AddPrimaryKeyOperation), typeof(AddUniqueConstraintOperation), typeof(AlterSequenceOperation)
+ };
- private static readonly Type[] _renameOperationTypes = { typeof(RenameColumnOperation), typeof(RenameIndexOperation), typeof(RenameSequenceOperation) };
+ private static readonly Type[] _renameOperationTypes =
+ {
+ typeof(RenameColumnOperation), typeof(RenameIndexOperation), typeof(RenameSequenceOperation)
+ };
private static readonly Type[] _columnOperationTypes = { typeof(AddColumnOperation), typeof(AlterColumnOperation) };
@@ -455,7 +468,8 @@ protected virtual IEnumerable Remove([NotNull] IModel source
/// 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.
///
- protected virtual IEnumerable Diff([NotNull] IEnumerable source, [NotNull] IEnumerable target, [NotNull] DiffContext diffContext)
+ protected virtual IEnumerable Diff(
+ [NotNull] IEnumerable source, [NotNull] IEnumerable target, [NotNull] DiffContext diffContext)
=> DiffCollection(
source,
target,
@@ -471,7 +485,8 @@ protected virtual IEnumerable Diff([NotNull] IEnumerable
- protected virtual IEnumerable Diff([NotNull] string source, [NotNull] string target, [NotNull] DiffContext diffContext)
+ protected virtual IEnumerable Diff(
+ [NotNull] string source, [NotNull] string target, [NotNull] DiffContext diffContext)
=> Enumerable.Empty();
///
@@ -482,10 +497,7 @@ protected virtual IEnumerable Diff([NotNull] string source,
///
protected virtual IEnumerable Add([NotNull] string target, [NotNull] DiffContext diffContext)
{
- yield return new EnsureSchemaOperation
- {
- Name = target
- };
+ yield return new EnsureSchemaOperation { Name = target };
}
///
@@ -552,10 +564,7 @@ protected virtual IEnumerable Diff(
{
yield return new RenameTableOperation
{
- Schema = source.Schema,
- Name = source.Name,
- NewSchema = target.Schema,
- NewName = target.Name
+ Schema = source.Schema, Name = source.Name, NewSchema = target.Schema, NewName = target.Name
};
}
@@ -571,10 +580,7 @@ protected virtual IEnumerable Diff(
Name = target.Name,
Schema = target.Schema,
Comment = target.GetComment(),
- OldTable =
- {
- Comment = source.GetComment()
- }
+ OldTable = { Comment = source.GetComment() }
};
alterTableOperation.AddAnnotations(targetMigrationsAnnotations);
@@ -608,9 +614,7 @@ protected virtual IEnumerable Add(
var entityType = target.EntityTypes[0];
var createTableOperation = new CreateTableOperation
{
- Schema = target.Schema,
- Name = target.Name,
- Comment = target.GetComment()
+ Schema = target.Schema, Name = target.Name, Comment = target.GetComment()
};
createTableOperation.AddAnnotations(MigrationsAnnotations.For(entityType));
@@ -621,6 +625,7 @@ protected virtual IEnumerable Add(
{
createTableOperation.PrimaryKey = Add(primaryKey, diffContext).Cast().Single();
}
+
createTableOperation.UniqueConstraints.AddRange(
target.GetKeys().Where(k => !k.IsPrimaryKey()).SelectMany(k => Add(k, diffContext))
.Cast());
@@ -650,11 +655,7 @@ protected virtual IEnumerable Add(
protected virtual IEnumerable Remove(
[NotNull] TableMapping source, [NotNull] DiffContext diffContext)
{
- var operation = new DropTableOperation
- {
- Schema = source.Schema,
- Name = source.Name
- };
+ var operation = new DropTableOperation { Schema = source.Schema, Name = source.Name };
operation.AddAnnotations(MigrationsAnnotations.ForRemove(source.EntityTypes[0]));
diffContext.AddDrop(source, operation);
@@ -709,10 +710,7 @@ private static IEnumerable GetSortedProperties(IEntityType entityType
}
groups.Add(
- clrProperty, new List
- {
- property
- });
+ clrProperty, new List { property });
}
var clrType = clrProperty.DeclaringType;
@@ -912,7 +910,8 @@ private static string GetDefiningNavigationName(IEntityType entityType)
/// 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.
///
- protected virtual IEnumerable Diff([NotNull] IProperty source, [NotNull] IProperty target, [NotNull] DiffContext diffContext)
+ protected virtual IEnumerable Diff(
+ [NotNull] IProperty source, [NotNull] IProperty target, [NotNull] DiffContext diffContext)
{
var targetEntityType = target.DeclaringEntityType.GetRootType();
@@ -990,9 +989,7 @@ protected virtual IEnumerable Add(
var operation = new AddColumnOperation
{
- Schema = targetEntityType.GetSchema(),
- Table = targetEntityType.GetTableName(),
- Name = target.GetColumnName()
+ Schema = targetEntityType.GetSchema(), Table = targetEntityType.GetTableName(), Name = target.GetColumnName()
};
Initialize(
@@ -1014,9 +1011,7 @@ protected virtual IEnumerable Remove([NotNull] IProperty sou
var operation = new DropColumnOperation
{
- Schema = sourceEntityType.GetSchema(),
- Table = sourceEntityType.GetTableName(),
- Name = source.GetColumnName()
+ Schema = sourceEntityType.GetSchema(), Table = sourceEntityType.GetTableName(), Name = source.GetColumnName()
};
operation.AddAnnotations(MigrationsAnnotations.ForRemove(source));
@@ -1150,18 +1145,14 @@ protected virtual IEnumerable Remove(
{
operation = new DropPrimaryKeyOperation
{
- Schema = sourceEntityType.GetSchema(),
- Table = sourceEntityType.GetTableName(),
- Name = source.GetName()
+ Schema = sourceEntityType.GetSchema(), Table = sourceEntityType.GetTableName(), Name = source.GetName()
};
}
else
{
operation = new DropUniqueConstraintOperation
{
- Schema = sourceEntityType.GetSchema(),
- Table = sourceEntityType.GetTableName(),
- Name = source.GetName()
+ Schema = sourceEntityType.GetSchema(), Table = sourceEntityType.GetTableName(), Name = source.GetName()
};
}
@@ -1371,9 +1362,7 @@ protected virtual IEnumerable Remove([NotNull] IIndex source
var operation = new DropIndexOperation
{
- Name = source.GetName(),
- Schema = sourceEntityType.GetSchema(),
- Table = sourceEntityType.GetTableName()
+ Name = source.GetName(), Schema = sourceEntityType.GetSchema(), Table = sourceEntityType.GetTableName()
};
operation.AddAnnotations(MigrationsAnnotations.ForRemove(source));
@@ -1427,10 +1416,7 @@ protected virtual IEnumerable Add([NotNull] ICheckConstraint
var operation = new CreateCheckConstraintOperation
{
- Name = target.Name,
- Sql = target.Sql,
- Schema = targetEntityType.GetSchema(),
- Table = targetEntityType.GetTableName()
+ Name = target.Name, Sql = target.Sql, Schema = targetEntityType.GetSchema(), Table = targetEntityType.GetTableName()
};
operation.Sql = target.Sql;
@@ -1451,9 +1437,7 @@ protected virtual IEnumerable Remove([NotNull] ICheckConstra
var operation = new DropCheckConstraintOperation
{
- Name = source.Name,
- Schema = sourceEntityType.GetSchema(),
- Table = sourceEntityType.GetTableName()
+ Name = source.Name, Schema = sourceEntityType.GetSchema(), Table = sourceEntityType.GetTableName()
};
operation.AddAnnotations(MigrationsAnnotations.ForRemove(source));
@@ -1493,28 +1477,21 @@ protected virtual IEnumerable Diff(
/// 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.
///
- protected virtual IEnumerable Diff([NotNull] ISequence source, [NotNull] ISequence target, [NotNull] DiffContext diffContext)
+ protected virtual IEnumerable Diff(
+ [NotNull] ISequence source, [NotNull] ISequence target, [NotNull] DiffContext diffContext)
{
if (source.Schema != target.Schema
|| source.Name != target.Name)
{
yield return new RenameSequenceOperation
{
- Schema = source.Schema,
- Name = source.Name,
- NewSchema = target.Schema,
- NewName = target.Name
+ Schema = source.Schema, Name = source.Name, NewSchema = target.Schema, NewName = target.Name
};
}
if (source.StartValue != target.StartValue)
{
- yield return new RestartSequenceOperation
- {
- Schema = target.Schema,
- Name = target.Name,
- StartValue = target.StartValue
- };
+ yield return new RestartSequenceOperation { Schema = target.Schema, Name = target.Name, StartValue = target.StartValue };
}
var sourceMigrationsAnnotations = MigrationsAnnotations.For(source).ToList();
@@ -1526,11 +1503,7 @@ protected virtual IEnumerable Diff([NotNull] ISequence sourc
|| source.IsCyclic != target.IsCyclic
|| HasDifferences(sourceMigrationsAnnotations, targetMigrationsAnnotations))
{
- var alterSequenceOperation = new AlterSequenceOperation
- {
- Schema = target.Schema,
- Name = target.Name
- };
+ var alterSequenceOperation = new AlterSequenceOperation { Schema = target.Schema, Name = target.Name };
Initialize(alterSequenceOperation, target, targetMigrationsAnnotations);
Initialize(alterSequenceOperation.OldSequence, source, sourceMigrationsAnnotations);
@@ -1549,10 +1522,7 @@ protected virtual IEnumerable Add([NotNull] ISequence target
{
var operation = new CreateSequenceOperation
{
- Schema = target.Schema,
- Name = target.Name,
- ClrType = target.ClrType,
- StartValue = target.StartValue
+ Schema = target.Schema, Name = target.Name, ClrType = target.ClrType, StartValue = target.StartValue
};
yield return Initialize(operation, target, MigrationsAnnotations.For(target));
@@ -1566,11 +1536,7 @@ protected virtual IEnumerable Add([NotNull] ISequence target
///
protected virtual IEnumerable Remove([NotNull] ISequence source, [NotNull] DiffContext diffContext)
{
- var operation = new DropSequenceOperation
- {
- Schema = source.Schema,
- Name = source.Name
- };
+ var operation = new DropSequenceOperation { Schema = source.Schema, Name = source.Name };
operation.AddAnnotations(MigrationsAnnotations.ForRemove(source));
yield return operation;
@@ -1830,7 +1796,8 @@ var modelValuesChanged
var convertedType = sourceConverter?.ProviderClrType
?? targetConverter?.ProviderClrType;
- var storeValuesChanged = convertedSourceValue?.GetType().UnwrapNullableType() != convertedTargetValue?.GetType().UnwrapNullableType();
+ var storeValuesChanged = convertedSourceValue?.GetType().UnwrapNullableType()
+ != convertedTargetValue?.GetType().UnwrapNullableType();
if (!storeValuesChanged
&& convertedType != null)
@@ -1962,7 +1929,8 @@ protected virtual IEnumerable GetDataOperations([NotNull] Di
{
batchInsertOperation.Values =
AddToMultidimensionalArray(
- c.ColumnModifications.Where(col => col.IsKey || col.IsWrite).Select(GetValue).ToList(), batchInsertOperation.Values);
+ c.ColumnModifications.Where(col => col.IsKey || col.IsWrite).Select(GetValue).ToList(),
+ batchInsertOperation.Values);
continue;
}
@@ -1973,7 +1941,8 @@ protected virtual IEnumerable GetDataOperations([NotNull] Di
{
Schema = c.Schema,
Table = c.TableName,
- Columns = c.ColumnModifications.Where(col => col.IsKey || col.IsWrite).Select(col => col.ColumnName).ToArray(),
+ Columns = c.ColumnModifications.Where(col => col.IsKey || col.IsWrite).Select(col => col.ColumnName)
+ .ToArray(),
Values = ToMultidimensionalArray(
c.ColumnModifications.Where(col => col.IsKey || col.IsWrite).Select(GetValue).ToList())
};
@@ -2129,7 +2098,8 @@ protected virtual bool HasDifferences([NotNull] IEnumerable source,
foreach (var annotation in source)
{
- var index = unmatched.FindIndex(a => a.Name == annotation.Name && StructuralComparisons.StructuralEqualityComparer.Equals(a.Value, annotation.Value));
+ var index = unmatched.FindIndex(
+ a => a.Name == annotation.Name && StructuralComparisons.StructuralEqualityComparer.Equals(a.Value, annotation.Value));
if (index == -1)
{
return true;
diff --git a/src/EFCore.Relational/Query/Internal/ContainsTranslator.cs b/src/EFCore.Relational/Query/Internal/ContainsTranslator.cs
index e3f0a0c7fac..3a5c86a6825 100644
--- a/src/EFCore.Relational/Query/Internal/ContainsTranslator.cs
+++ b/src/EFCore.Relational/Query/Internal/ContainsTranslator.cs
@@ -27,8 +27,8 @@ public virtual SqlExpression Translate(SqlExpression instance, MethodInfo method
}
if ((method.DeclaringType.GetInterfaces().Contains(typeof(IList))
- || method.DeclaringType.IsGenericType
- && method.DeclaringType.GetGenericTypeDefinition() == typeof(ICollection<>))
+ || method.DeclaringType.IsGenericType
+ && method.DeclaringType.GetGenericTypeDefinition() == typeof(ICollection<>))
&& string.Equals(method.Name, nameof(IList.Contains)))
{
return _sqlExpressionFactory.In(arguments[0], instance, false);
diff --git a/src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs b/src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
index 163e5f472f5..7a2969d0b03 100644
--- a/src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
+++ b/src/EFCore.Relational/Query/Internal/SqlExpressionOptimizingExpressionVisitor.cs
@@ -13,15 +13,16 @@ public class SqlExpressionOptimizingExpressionVisitor : ExpressionVisitor
private static bool TryNegate(ExpressionType expressionType, out ExpressionType result)
{
- var negated = expressionType switch {
- ExpressionType.AndAlso => ExpressionType.OrElse,
- ExpressionType.OrElse => ExpressionType.AndAlso,
- ExpressionType.Equal => ExpressionType.NotEqual,
- ExpressionType.NotEqual => ExpressionType.Equal,
- ExpressionType.GreaterThan => ExpressionType.LessThanOrEqual,
+ var negated = expressionType switch
+ {
+ ExpressionType.AndAlso => ExpressionType.OrElse,
+ ExpressionType.OrElse => ExpressionType.AndAlso,
+ ExpressionType.Equal => ExpressionType.NotEqual,
+ ExpressionType.NotEqual => ExpressionType.Equal,
+ ExpressionType.GreaterThan => ExpressionType.LessThanOrEqual,
ExpressionType.GreaterThanOrEqual => ExpressionType.LessThan,
- ExpressionType.LessThan => ExpressionType.GreaterThanOrEqual,
- ExpressionType.LessThanOrEqual => ExpressionType.GreaterThan,
+ ExpressionType.LessThan => ExpressionType.GreaterThanOrEqual,
+ ExpressionType.LessThanOrEqual => ExpressionType.GreaterThan,
_ => (ExpressionType?)null
};
@@ -40,11 +41,11 @@ public SqlExpressionOptimizingExpressionVisitor(ISqlExpressionFactory sqlExpress
protected override Expression VisitExtension(Expression extensionExpression)
=> extensionExpression switch
- {
- SqlUnaryExpression sqlUnaryExpression => VisitSqlUnaryExpression(sqlUnaryExpression),
- SqlBinaryExpression sqlBinaryExpression => VisitSqlBinaryExpression(sqlBinaryExpression),
- _ => base.VisitExtension(extensionExpression),
- };
+ {
+ SqlUnaryExpression sqlUnaryExpression => VisitSqlUnaryExpression(sqlUnaryExpression),
+ SqlBinaryExpression sqlBinaryExpression => VisitSqlBinaryExpression(sqlBinaryExpression),
+ _ => base.VisitExtension(extensionExpression),
+ };
protected virtual Expression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnaryExpression)
{
@@ -60,13 +61,13 @@ protected virtual Expression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnary
return SqlExpressionFactory.Constant(constantOperand.Value == null, sqlUnaryExpression.TypeMapping);
case ColumnExpression columnOperand
- when !columnOperand.IsNullable:
+ when !columnOperand.IsNullable:
return SqlExpressionFactory.Constant(false, sqlUnaryExpression.TypeMapping);
case SqlUnaryExpression sqlUnaryOperand
- when sqlUnaryOperand.OperatorType == ExpressionType.Convert
- || sqlUnaryOperand.OperatorType == ExpressionType.Not
- || sqlUnaryOperand.OperatorType == ExpressionType.Negate:
+ when sqlUnaryOperand.OperatorType == ExpressionType.Convert
+ || sqlUnaryOperand.OperatorType == ExpressionType.Not
+ || sqlUnaryOperand.OperatorType == ExpressionType.Negate:
return (SqlExpression)Visit(SqlExpressionFactory.IsNull(sqlUnaryOperand.Operand));
case SqlBinaryExpression sqlBinaryOperand:
@@ -74,9 +75,12 @@ protected virtual Expression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnary
var newRight = (SqlExpression)Visit(SqlExpressionFactory.IsNull(sqlBinaryOperand.Right));
return sqlBinaryOperand.OperatorType == ExpressionType.Coalesce
- ? SimplifyLogicalSqlBinaryExpression(ExpressionType.AndAlso, newLeft, newRight, sqlBinaryOperand.TypeMapping)
- : SimplifyLogicalSqlBinaryExpression(ExpressionType.OrElse, newLeft, newRight, sqlBinaryOperand.TypeMapping);
+ ? SimplifyLogicalSqlBinaryExpression(
+ ExpressionType.AndAlso, newLeft, newRight, sqlBinaryOperand.TypeMapping)
+ : SimplifyLogicalSqlBinaryExpression(
+ ExpressionType.OrElse, newLeft, newRight, sqlBinaryOperand.TypeMapping);
}
+
break;
case ExpressionType.NotEqual:
@@ -86,13 +90,13 @@ protected virtual Expression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnary
return SqlExpressionFactory.Constant(constantOperand.Value != null, sqlUnaryExpression.TypeMapping);
case ColumnExpression columnOperand
- when !columnOperand.IsNullable:
+ when !columnOperand.IsNullable:
return SqlExpressionFactory.Constant(true, sqlUnaryExpression.TypeMapping);
case SqlUnaryExpression sqlUnaryOperand
- when sqlUnaryOperand.OperatorType == ExpressionType.Convert
- || sqlUnaryOperand.OperatorType == ExpressionType.Not
- || sqlUnaryOperand.OperatorType == ExpressionType.Negate:
+ when sqlUnaryOperand.OperatorType == ExpressionType.Convert
+ || sqlUnaryOperand.OperatorType == ExpressionType.Not
+ || sqlUnaryOperand.OperatorType == ExpressionType.Negate:
return (SqlExpression)Visit(SqlExpressionFactory.IsNotNull(sqlUnaryOperand.Operand));
case SqlBinaryExpression sqlBinaryOperand:
@@ -101,8 +105,10 @@ protected virtual Expression VisitSqlUnaryExpression(SqlUnaryExpression sqlUnary
return sqlBinaryOperand.OperatorType == ExpressionType.Coalesce
? SimplifyLogicalSqlBinaryExpression(ExpressionType.OrElse, newLeft, newRight, sqlBinaryOperand.TypeMapping)
- : SimplifyLogicalSqlBinaryExpression(ExpressionType.AndAlso, newLeft, newRight, sqlBinaryOperand.TypeMapping);
+ : SimplifyLogicalSqlBinaryExpression(
+ ExpressionType.AndAlso, newLeft, newRight, sqlBinaryOperand.TypeMapping);
}
+
break;
}
@@ -169,7 +175,8 @@ private Expression VisitNot(SqlUnaryExpression sqlUnaryExpression)
// they are safe to do here because null semantics removes possibility of nulls in the tree
// however if we decide to do "partial" null semantics (that doesn't distinguish between NULL and FALSE, e.g. for predicates)
// we need to be extra careful here
- if (!_useRelationalNulls && TryNegate(innerBinary.OperatorType, out var negated))
+ if (!_useRelationalNulls
+ && TryNegate(innerBinary.OperatorType, out var negated))
{
return Visit(
SqlExpressionFactory.MakeBinary(
@@ -205,7 +212,8 @@ private Expression VisitSqlBinaryExpression(SqlBinaryExpression sqlBinaryExpress
// however if we decide to do "partial" null semantics (that doesn't distinguish between NULL and FALSE, e.g. for predicates)
// we need to be extra careful here
if (!_useRelationalNulls
- && (sqlBinaryExpression.OperatorType == ExpressionType.Equal || sqlBinaryExpression.OperatorType == ExpressionType.NotEqual))
+ && (sqlBinaryExpression.OperatorType == ExpressionType.Equal
+ || sqlBinaryExpression.OperatorType == ExpressionType.NotEqual))
{
// op(a, b) == true -> op(a, b)
// op(a, b) != false -> op(a, b)
@@ -213,7 +221,9 @@ private Expression VisitSqlBinaryExpression(SqlBinaryExpression sqlBinaryExpress
// op(a, b) != true -> !op(a, b)
var constant = sqlBinaryExpression.Left as SqlConstantExpression ?? sqlBinaryExpression.Right as SqlConstantExpression;
var binary = sqlBinaryExpression.Left as SqlBinaryExpression ?? sqlBinaryExpression.Right as SqlBinaryExpression;
- if (constant != null && binary != null && TryNegate(binary.OperatorType, out var negated))
+ if (constant != null
+ && binary != null
+ && TryNegate(binary.OperatorType, out var negated))
{
return (bool)constant.Value == (sqlBinaryExpression.OperatorType == ExpressionType.Equal)
? binary
@@ -248,7 +258,8 @@ private SqlExpression SimplifyLogicalSqlBinaryExpression(
? newLeftConstant
: newRight;
}
- else if (newRight is SqlConstantExpression newRightConstant)
+
+ if (newRight is SqlConstantExpression newRightConstant)
{
// a && true -> a
// a || true -> true
diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs
index 6c11f6228b5..afacb5b3cc6 100644
--- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs
+++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs
@@ -17,6 +17,7 @@ public class QuerySqlGenerator : SqlExpressionVisitor
{
private static readonly Regex _composibleSql
= new Regex(@"^\s*?SELECT\b", RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(value: 1000.0));
+
private readonly IRelationalCommandBuilderFactory _relationalCommandBuilderFactory;
private readonly ISqlGenerationHelper _sqlGenerationHelper;
private IRelationalCommandBuilder _relationalCommandBuilder;
@@ -97,19 +98,21 @@ protected override Expression VisitSqlFragment(SqlFragmentExpression sqlFragment
private bool IsNonComposedSetOperation(SelectExpression selectExpression)
=> selectExpression.Offset == null
- && selectExpression.Limit == null
- && !selectExpression.IsDistinct
- && selectExpression.Predicate == null
- && selectExpression.Having == null
- && selectExpression.Orderings.Count == 0
- && selectExpression.GroupBy.Count == 0
- && selectExpression.Tables.Count == 1
- && selectExpression.Tables[0] is SetOperationBase setOperation
- && selectExpression.Projection.Count == setOperation.Source1.Projection.Count
- && selectExpression.Projection.Select((pe, index) => pe.Expression is ColumnExpression column
- && string.Equals(column.Table.Alias, setOperation.Alias, StringComparison.OrdinalIgnoreCase)
- && string.Equals(column.Name, setOperation.Source1.Projection[index].Alias, StringComparison.OrdinalIgnoreCase))
- .All(e => e);
+ && selectExpression.Limit == null
+ && !selectExpression.IsDistinct
+ && selectExpression.Predicate == null
+ && selectExpression.Having == null
+ && selectExpression.Orderings.Count == 0
+ && selectExpression.GroupBy.Count == 0
+ && selectExpression.Tables.Count == 1
+ && selectExpression.Tables[0] is SetOperationBase setOperation
+ && selectExpression.Projection.Count == setOperation.Source1.Projection.Count
+ && selectExpression.Projection.Select(
+ (pe, index) => pe.Expression is ColumnExpression column
+ && string.Equals(column.Table.Alias, setOperation.Alias, StringComparison.OrdinalIgnoreCase)
+ && string.Equals(
+ column.Name, setOperation.Source1.Projection[index].Alias, StringComparison.OrdinalIgnoreCase))
+ .All(e => e);
protected override Expression VisitSelect(SelectExpression selectExpression)
{
diff --git a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs
index c959ad0fb0b..4808b9218c4 100644
--- a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs
+++ b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs
@@ -6,7 +6,6 @@
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
-using System.Reflection;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
@@ -257,7 +256,8 @@ protected override ShapedQueryExpression TranslateDistinct(ShapedQueryExpression
return source;
}
- protected override ShapedQueryExpression TranslateElementAtOrDefault(ShapedQueryExpression source, Expression index, bool returnDefault)
+ protected override ShapedQueryExpression TranslateElementAtOrDefault(
+ ShapedQueryExpression source, Expression index, bool returnDefault)
=> null;
protected override ShapedQueryExpression TranslateExcept(ShapedQueryExpression source1, ShapedQueryExpression source2)
@@ -320,10 +320,7 @@ protected override ShapedQueryExpression TranslateGroupBy(
var original2 = resultSelector.Parameters[1];
var newResultSelectorBody = new ReplacingExpressionVisitor(
- new Dictionary
- {
- { original1, translatedKey }, { original2, source.ShaperExpression }
- })
+ new Dictionary { { original1, translatedKey }, { original2, source.ShaperExpression } })
.Visit(resultSelector.Body);
newResultSelectorBody = ExpandWeakEntities(selectExpression, newResultSelectorBody);
@@ -587,10 +584,7 @@ protected override ShapedQueryExpression TranslateLongCount(ShapedQueryExpressio
return null;
}
- var projectionMapping = new Dictionary
- {
- { new ProjectionMember(), translation }
- };
+ var projectionMapping = new Dictionary { { new ProjectionMember(), translation } };
selectExpression.ClearOrdering();
selectExpression.ReplaceProjectionMapping(projectionMapping);
diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
index 094c44a62e4..2f4690b1d3d 100644
--- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
+++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.InExpressionValuesExpandingExpressionVisitor.cs
@@ -48,7 +48,7 @@ public override Expression Visit(Expression expression)
inValues.Add(value);
}
-
+
break;
}
@@ -66,7 +66,7 @@ public override Expression Visit(Expression expression)
inValues.Add(value);
}
-
+
break;
}
}
diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs
index 993dbe30b46..82a1cc5c26d 100644
--- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs
+++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterNullabilityOptimizingExpressionVisitor.cs
@@ -32,7 +32,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
// if predicate is optimized to true, we can simply remove it
var newPredicate = newSelectExpression.Predicate is SqlConstantExpression newSelectPredicateConstant
- && !(selectExpression.Predicate is SqlConstantExpression)
+ && !(selectExpression.Predicate is SqlConstantExpression)
? (bool)newSelectPredicateConstant.Value
? null
: SqlExpressionFactory.Equal(
@@ -41,7 +41,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
: newSelectExpression.Predicate;
var newHaving = newSelectExpression.Having is SqlConstantExpression newSelectHavingConstant
- && !(selectExpression.Having is SqlConstantExpression)
+ && !(selectExpression.Having is SqlConstantExpression)
? (bool)newSelectHavingConstant.Value
? null
: SqlExpressionFactory.Equal(
@@ -50,7 +50,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
: newSelectExpression.Having;
return newPredicate != newSelectExpression.Predicate
- || newHaving != newSelectExpression.Having
+ || newHaving != newSelectExpression.Having
? newSelectExpression.Update(
newSelectExpression.Projection.ToList(),
newSelectExpression.Tables.ToList(),
diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterValueBasedSelectExpressionOptimizer.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterValueBasedSelectExpressionOptimizer.cs
index f853136a736..918c5e7386f 100644
--- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterValueBasedSelectExpressionOptimizer.cs
+++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.ParameterValueBasedSelectExpressionOptimizer.cs
@@ -25,7 +25,8 @@ public ParameterValueBasedSelectExpressionOptimizer(
_useRelationalNulls = useRelationalNulls;
}
- public (SelectExpression selectExpression, bool canCache) Optimize(SelectExpression selectExpression, IReadOnlyDictionary parametersValues)
+ public (SelectExpression selectExpression, bool canCache) Optimize(
+ SelectExpression selectExpression, IReadOnlyDictionary parametersValues)
{
var canCache = true;
diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
index 1fa982a1c91..d24f08c9656 100644
--- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
+++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.QueryingEnumerable.cs
@@ -39,8 +39,10 @@ public QueryingEnumerable(
_contextType = contextType;
_logger = logger;
}
+
public IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
=> new AsyncEnumerator(this, cancellationToken);
+
public IEnumerator GetEnumerator() => new Enumerator(this);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
diff --git a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.RelationalCommandCache.cs b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.RelationalCommandCache.cs
index a4f4d8a3108..0143e957099 100644
--- a/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.RelationalCommandCache.cs
+++ b/src/EFCore.Relational/Query/RelationalShapedQueryCompilingExpressionVisitor.RelationalCommandCache.cs
@@ -16,6 +16,7 @@ private class RelationalCommandCache
{
private static readonly ConcurrentDictionary