Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move extensions classes to consistent locations #16005

Merged
merged 1 commit into from
Jun 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions EFCore.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -189,7 +189,9 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
<s:Boolean x:Key="/Default/UserDictionary/Words/=annotatable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=keyless/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=navigations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=remapper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=requiredness/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=shaper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sqlite/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unignore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fixup/@EntryIndexedValue">True</s:Boolean>
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
public static class CosmosDbContextOptionsExtensions
1 change: 1 addition & 0 deletions src/EFCore.Cosmos/Extensions/CosmosLoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
public static class CosmosLoggerExtensions
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
{
public static class CosmosServiceCollectionExtensions
1 change: 1 addition & 0 deletions src/EFCore.Design/Design/Internal/DbContextOperations.cs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Pipeline;
using Microsoft.EntityFrameworkCore.Storage;

2 changes: 1 addition & 1 deletion src/EFCore.InMemory/Query/Pipeline/Translator.cs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
using System;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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 System.Threading.Tasks
{
internal static class RelationalTaskExtensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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.

using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;

namespace Microsoft.EntityFrameworkCore.Infrastructure
{
public static class RelationalPropertyExtensions
{
/// <summary>
/// Creates a comma-separated list of property names.
/// </summary>
/// <param name="properties"> The properties to format. </param>
/// <returns> A comma-separated list of property names. </returns>
public static string FormatColumns([NotNull] this IEnumerable<IProperty> properties)
=> "{" + string.Join(", ", properties.Select(p => "'" + p.GetColumnName() + "'")) + "}";
}
}
39 changes: 0 additions & 39 deletions src/EFCore.Relational/Internal/RelationalPropertyExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.

using System.Diagnostics;
using JetBrains.Annotations;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
@@ -48,5 +49,15 @@ public static IForeignKey FindSharedTableLink([NotNull] this IProperty property)

return null;
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
[DebuggerStepThrough]
public static string GetConfiguredColumnType([NotNull] this IProperty property)
=> (string)property[RelationalAnnotationNames.ColumnType];
}
}
Original file line number Diff line number Diff line change
@@ -2,13 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;
@@ -157,10 +155,8 @@ protected override Expression VisitTypeBinary(TypeBinaryExpression typeBinaryExp
_sqlExpressionFactory.Constant(concreteEntityTypes.Select(et => et.GetDiscriminatorValue()).ToList()),
negated: false);
}
else
{
return _sqlExpressionFactory.Constant(false);
}

return _sqlExpressionFactory.Constant(false);
}

return null;
@@ -189,15 +185,11 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
{
return subquery.Projection[0].Expression;
}
else
{
throw new InvalidOperationException();
}
}
else
{
return new SubSelectExpression(subquery);

throw new InvalidOperationException();
}

return new SubSelectExpression(subquery);
}

var @object = Visit(methodCallExpression.Object);
@@ -393,8 +385,6 @@ protected override Expression VisitUnary(UnaryExpression unaryExpression)

[DebuggerStepThrough]
private bool TranslationFailed(Expression original, Expression translation)
{
return original == null ? false : !(translation is SqlExpression);
}
=> original != null && !(translation is SqlExpression);
}
}
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Update/ColumnModification.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;

Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Sqlite.Infrastructure.Internal;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
using Microsoft.EntityFrameworkCore.Sqlite.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
using Microsoft.EntityFrameworkCore.Sqlite.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using NetTopologySuite;

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
2 changes: 1 addition & 1 deletion src/EFCore/ChangeTracking/Internal/IdentityMap.cs
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public IdentityMap(
{
_foreignKeys = key.DeclaringEntityType
.GetDerivedTypesInclusive()
.SelectMany(e => e.GetDeclaredForeignKeys())
.SelectMany(EntityTypeExtensions.GetDeclaredForeignKeys)
.ToArray();
}
}
3 changes: 1 addition & 2 deletions src/EFCore/Diagnostics/CoreLoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
@@ -34,8 +35,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </summary>
public static class CoreLoggerExtensions
{
private const int QueryModelStringLengthLimit = 100;

/// <summary>
/// Logs for the <see cref="CoreEventId.SaveChangesFailed" /> event.
/// </summary>
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Utilities;
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ public static IServiceCollection AddDbContext<TContextService, TContextImplement
serviceCollection,
optionsAction == null
? (Action<IServiceProvider, DbContextOptionsBuilder>)null
: (p, b) => optionsAction?.Invoke(b), contextLifetime, optionsLifetime);
: (p, b) => optionsAction.Invoke(b), contextLifetime, optionsLifetime);

/// <summary>
/// Registers the given context as a service in the <see cref="IServiceCollection" /> and enables DbContext pooling.
@@ -219,7 +219,7 @@ public static IServiceCollection AddDbContextPool<TContext>(
[NotNull] Action<IServiceProvider, DbContextOptionsBuilder> optionsAction,
int poolSize = 128)
where TContext : DbContext
=> AddDbContextPool<TContext, TContext>(serviceCollection, optionsAction);
=> AddDbContextPool<TContext, TContext>(serviceCollection, optionsAction, poolSize);
AndriySvyryd marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// <para>
3 changes: 2 additions & 1 deletion src/EFCore/Extensions/Internal/EFPropertyExtensions.cs
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;

namespace Microsoft.EntityFrameworkCore.Extensions.Internal
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using System.Linq;
using JetBrains.Annotations;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
62 changes: 38 additions & 24 deletions src/EFCore/Extensions/Internal/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
@@ -332,25 +332,12 @@ public static Expression Assign(
if (memberExpression.Member is FieldInfo fieldInfo
&& fieldInfo.IsInitOnly)
{
if (new FrameworkName(AppContext.TargetFrameworkName).Identifier == ".NETCoreApp")
{
return (BinaryExpression)Activator.CreateInstance(
_assignBinaryExpressionType,
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { memberExpression, valueExpression },
null);
}

// On .NET Framework the compiler refuses to compile an expression tree with IsInitOnly access,
AndriySvyryd marked this conversation as resolved.
Show resolved Hide resolved
// so use Reflection's SetValue instead.
return Expression.Call(
Expression.Constant(fieldInfo),
_fieldInfoSetValueMethod,
memberExpression.Expression,
Expression.Convert(
valueExpression,
typeof(object)));
return (BinaryExpression)Activator.CreateInstance(
_assignBinaryExpressionType,
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { memberExpression, valueExpression },
null);
}

return Expression.Assign(memberExpression, valueExpression);
@@ -359,25 +346,46 @@ public static Expression Assign(
private static readonly Type _assignBinaryExpressionType
= typeof(Expression).Assembly.GetType("System.Linq.Expressions.AssignBinaryExpression");

private static readonly MethodInfo _fieldInfoSetValueMethod
= typeof(FieldInfo).GetRuntimeMethod(nameof(FieldInfo.SetValue), new[] { typeof(object), typeof(object) });

/// <summary>
AndriySvyryd marked this conversation as resolved.
Show resolved Hide resolved
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static LambdaExpression GetLambdaOrNull(this Expression expression)
=> expression is LambdaExpression lambda
? lambda
: expression is UnaryExpression unary && expression.NodeType == ExpressionType.Quote
? (LambdaExpression)unary.Operand
: null;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static LambdaExpression UnwrapQuote(this Expression expression)
=> expression is UnaryExpression unary && expression.NodeType == ExpressionType.Quote
? (LambdaExpression)unary.Operand
: (LambdaExpression)expression;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static bool IsIncludeMethod(this MethodCallExpression methodCallExpression)
=> methodCallExpression.Method.DeclaringType == typeof(EntityFrameworkQueryableExtensions)
&& methodCallExpression.Method.Name == nameof(EntityFrameworkQueryableExtensions.Include);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static Expression BuildPropertyAccess(this Expression root, List<string> path)
{
var result = root;
@@ -389,13 +397,19 @@ public static Expression BuildPropertyAccess(this Expression root, List<string>
return result;
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static Expression CombineAndRemap(
Expression source,
this Expression source,
ParameterExpression sourceParameter,
Expression replaceWith)
=> new ExpressionCombiningVisitor(sourceParameter, replaceWith).Visit(source);

public class ExpressionCombiningVisitor : ExpressionVisitor
private class ExpressionCombiningVisitor : ExpressionVisitor
{
private ParameterExpression _sourceParameter;
private Expression _replaceWith;
2 changes: 1 addition & 1 deletion src/EFCore/Extensions/Internal/MethodInfoExtensions.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using JetBrains.Annotations;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Extensions.Internal
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
22 changes: 21 additions & 1 deletion src/EFCore/Extensions/Internal/QueryableExtensions.cs
Original file line number Diff line number Diff line change
@@ -4,12 +4,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.Extensions.Internal
// ReSharper disable CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -42,5 +46,21 @@ public static IAsyncEnumerable<TSource> AsAsyncEnumerable<TSource>(

throw new InvalidOperationException(CoreStrings.IQueryableNotAsync(typeof(TSource)));
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(
this IQueryable<TOuter> outer,
IEnumerable<TInner> inner,
Expression<Func<TOuter, TKey>> outerKeySelector,
Expression<Func<TInner, TKey>> innerKeySelector,
Expression<Func<TOuter, TInner, TResult>> resultSelector)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using System.Text;
using JetBrains.Annotations;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
@@ -181,5 +182,35 @@ public static IEnumerable<string> GetNamespaces([NotNull] this Type type)
}
}
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static string GenerateParameterName(this Type type)
{
var sb = new StringBuilder();
var removeLowerCase = sb.Append(type.Name.Where(char.IsUpper).ToArray()).ToString();

return removeLowerCase.Length > 0 ? removeLowerCase.ToLower() : type.Name.ToLower().Substring(0, 1);
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static bool IsQueryableType(this Type type)
{
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IQueryable<>))
{
return true;
}

return type.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IQueryable<>));
}
}
}
1 change: 1 addition & 0 deletions src/EFCore/Extensions/ObservableCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
1 change: 1 addition & 0 deletions src/EFCore/Extensions/PropertyBaseExtensions.cs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
3 changes: 2 additions & 1 deletion src/EFCore/Infrastructure/AccessorExtensions.cs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

@@ -43,7 +44,7 @@ public static class AccessorExtensions
/// <returns> The requested service. </returns>
[DebuggerStepThrough]
public static TService GetService<TService>([NotNull] this IInfrastructure<IServiceProvider> accessor)
=> InternalAccessorExtensions.GetService<TService>(Check.NotNull(accessor, nameof(accessor)));
=> InfrastructureExtensions.GetService<TService>(Check.NotNull(accessor, nameof(accessor)));

/// <summary>
/// <para>
Original file line number Diff line number Diff line change
@@ -4,9 +4,8 @@
using System.Linq;
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
namespace Microsoft.EntityFrameworkCore.Infrastructure.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Original file line number Diff line number Diff line change
@@ -3,10 +3,8 @@

using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
namespace Microsoft.EntityFrameworkCore.Infrastructure.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Original file line number Diff line number Diff line change
@@ -5,18 +5,19 @@
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore.Internal
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Infrastructure.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// 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.
/// </summary>
public static class InternalAccessorExtensions
public static class InfrastructureExtensions
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
/// <summary>
4 changes: 2 additions & 2 deletions src/EFCore/Metadata/DependencyInjectionParameterBinding.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;

@@ -20,7 +20,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata
public class DependencyInjectionParameterBinding : ServiceParameterBinding
{
private static readonly MethodInfo _getServiceMethod
= typeof(InternalAccessorExtensions).GetMethod(nameof(InternalAccessorExtensions.GetService));
= typeof(InfrastructureExtensions).GetMethod(nameof(InfrastructureExtensions.GetService));

/// <summary>
/// Creates a new <see cref="DependencyInjectionParameterBinding" /> instance for the given service type.
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/EntityTypeExtensions.cs
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

// ReSharper disable ArgumentsStyleOther
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/ForeignKeyExtensions.cs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/IndexExtensions.cs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/KeyExtensions.cs
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/ModelExtensions.cs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
using System.Runtime.CompilerServices;
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/NavigationExtensions.cs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/PropertyExtensions.cs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.ValueGeneration;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
1 change: 1 addition & 0 deletions src/EFCore/Metadata/Internal/ServicePropertyExtensions.cs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;

namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Query.Pipeline;
using Microsoft.EntityFrameworkCore.Utilities;
Original file line number Diff line number Diff line change
@@ -5,10 +5,9 @@
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.Extensions.Internal
namespace Microsoft.EntityFrameworkCore.Query.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
1 change: 0 additions & 1 deletion src/EFCore/Query/Internal/ExpressionPrinter.cs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
Original file line number Diff line number Diff line change
@@ -6,13 +6,11 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Query.Pipeline;

namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion
{
@@ -57,8 +55,8 @@ public static NavigationExpansionExpression CreateNavigationExpansionRoot(
materializeCollectionNavigation?.ClrType ?? operand.Type);
}

private static MethodInfo _leftJoinMethodInfo = typeof(EntityQueryableExtensions).GetTypeInfo()
.GetDeclaredMethods(nameof(EntityQueryableExtensions.LeftJoin)).Single(mi => mi.GetParameters().Length == 5);
private static readonly MethodInfo _leftJoinMethodInfo = typeof(QueryableExtensions).GetTypeInfo()
.GetDeclaredMethods(nameof(QueryableExtensions.LeftJoin)).Single(mi => mi.GetParameters().Length == 5);

public static (Expression source, ParameterExpression parameter) AddNavigationJoin(
Expression sourceExpression,
@@ -123,8 +121,6 @@ public static (Expression source, ParameterExpression parameter) AddNavigationJo
innerKeySelectorBody,
innerKeySelectorParameter);

var oldParameterExpression = parameterExpression;

if (!sourceExpression.Type.IsQueryableType())
{
var asQueryableMethodInfo = LinqMethodHelpers.AsQueryable.MakeGenericMethod(sourceType);
@@ -171,7 +167,6 @@ var transparentIdentifierCtorInfo
innerKeySelector,
resultSelector);

sourceType = resultSelector.ReturnType;
sourceExpression = joinMethodCall;

var transparentIdentifierParameterName = resultSelectorInnerParameterName;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query.Internal;
@@ -19,7 +18,7 @@ namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
/// </summary>
public class CollectionNavigationRewritingVisitor : ExpressionVisitor
{
private ParameterExpression _sourceParameter;
private readonly ParameterExpression _sourceParameter;

public CollectionNavigationRewritingVisitor(ParameterExpression sourceParameter)
{
@@ -221,10 +220,8 @@ protected override Expression VisitMember(MemberExpression memberExpression)

return result;
}
else
{
return memberExpression.Update(newExpression);
}

return memberExpression.Update(newExpression);
}

return memberExpression;
@@ -233,7 +230,7 @@ protected override Expression VisitMember(MemberExpression memberExpression)
private static Expression CreateKeyComparisonExpressionForCollectionNavigationSubquery(
Expression outerKeyExpression,
Expression innerKeyExpression,
Expression colectionRootExpression)
Expression collectionRootExpression)
{
if (outerKeyExpression.Type != innerKeyExpression.Type)
{
@@ -254,8 +251,8 @@ private static Expression CreateKeyComparisonExpressionForCollectionNavigationSu

var outerNullProtection
= Expression.NotEqual(
colectionRootExpression,
Expression.Constant(null, colectionRootExpression.Type));
collectionRootExpression,
Expression.Constant(null, collectionRootExpression.Type));

return new CorrelationPredicateExpression(
outerNullProtection,
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// 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.

using System.Linq;
AndriySvyryd marked this conversation as resolved.
Show resolved Hide resolved
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
{
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;

public class PendingSelectorIncludeRewriter : ExpressionVisitor
{
protected override Expression VisitMember(MemberExpression memberExpression) => memberExpression;
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query.Internal;
@@ -108,7 +107,7 @@ private Expression ProcessMemberPushdown(
}

var selector = Expression.Lambda(selectorBody, selectorParameter);
var remappedSelectorBody = ExpressionExtensions.CombineAndRemap(selector.Body, selectorParameter, navigationExpansionExpression.State.PendingSelector.Body);
var remappedSelectorBody = selector.Body.CombineAndRemap(selectorParameter, navigationExpansionExpression.State.PendingSelector.Body);

var binder = new NavigationPropertyBindingVisitor(
navigationExpansionExpression.State.CurrentParameter,
@@ -136,7 +135,7 @@ private Expression ProcessMemberPushdown(
lastNavigation.ForeignKey.PrincipalKey.Properties),
innerParameter);

var combinedKeySelectorBody = ExpressionExtensions.CombineAndRemap(innerKeyAccessLambda.Body, innerKeyAccessLambda.Parameters[0], navigationExpansionExpression.State.PendingSelector.Body);
var combinedKeySelectorBody = innerKeyAccessLambda.Body.CombineAndRemap(innerKeyAccessLambda.Parameters[0], navigationExpansionExpression.State.PendingSelector.Body);
if (outerKeyAccess.Type != combinedKeySelectorBody.Type)
{
if (combinedKeySelectorBody.Type.IsNullableType())
@@ -230,7 +229,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
var rightConstantNull = binaryExpression.Right.IsNullConstantExpression();

// collection comparison must be optimized out before we visit the left and right
// otherwise collections would be rewriteen and harder to identify
// otherwise collections would be rewritten and harder to identify
if (binaryExpression.NodeType == ExpressionType.Equal
|| binaryExpression.NodeType == ExpressionType.NotEqual)
{
@@ -239,7 +238,7 @@ protected override Expression VisitBinary(BinaryExpression binaryExpression)
var rightParent = default(Expression);
var rightNavigation = default(INavigation);

// TODO: this is hacky and won't work for weak entity types
// TODO: this isn't robust and won't work for weak entity types
// also, add support for EF.Property and maybe convert node around the navigation
if (binaryExpression.Left is MemberExpression leftMember
&& leftMember.Type.TryGetSequenceType() is Type leftSequenceType
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query.Internal;
@@ -281,14 +280,14 @@ private Expression ProcessSelectMany(MethodCallExpression methodCallExpression)
var collectionSelector = methodCallExpression.Arguments[1].UnwrapQuote();
AdjustCurrentParameterName(outerSourceNee.State, collectionSelector.Parameters[0].Name);

var applyNavigsationsResult = FindAndApplyNavigations(outerSourceNee.Operand, collectionSelector, outerSourceNee.State);
var applyOrderingsResult = ApplyPendingOrderings(applyNavigsationsResult.source, applyNavigsationsResult.state);
var applyNavigationsResult = FindAndApplyNavigations(outerSourceNee.Operand, collectionSelector, outerSourceNee.State);
var applyOrderingsResult = ApplyPendingOrderings(applyNavigationsResult.source, applyNavigationsResult.state);

var outerSource = applyOrderingsResult.source;
var outerState = applyOrderingsResult.state;

var collectionSelectorNavigationExpansionExpression = applyNavigsationsResult.lambdaBody as NavigationExpansionExpression
?? (applyNavigsationsResult.lambdaBody as NavigationExpansionRootExpression)?.Unwrap() as NavigationExpansionExpression;
var collectionSelectorNavigationExpansionExpression = applyNavigationsResult.lambdaBody as NavigationExpansionExpression
?? (applyNavigationsResult.lambdaBody as NavigationExpansionRootExpression)?.Unwrap() as NavigationExpansionExpression;

if (collectionSelectorNavigationExpansionExpression != null)
{
@@ -299,29 +298,8 @@ private Expression ProcessSelectMany(MethodCallExpression methodCallExpression)
// it's not needed for SelectMany collection selectors as they are not directly projected
collectionSelectorState.MaterializeCollectionNavigation = null;

if (methodCallExpression.Method.MethodIsClosedFormOf(LinqMethodHelpers.QueryableSelectManyWithResultOperatorMethodInfo))
{
if (outerState.CurrentParameter.Name == null
&& outerState.CurrentParameter.Name != methodCallExpression.Arguments[2].UnwrapQuote().Parameters[0].Name)
{
var newOuterParameter = Expression.Parameter(outerState.CurrentParameter.Type, methodCallExpression.Arguments[2].UnwrapQuote().Parameters[0].Name);
outerState.PendingSelector = (LambdaExpression)new ExpressionReplacingVisitor(outerState.CurrentParameter, newOuterParameter).Visit(outerState.PendingSelector);
collectionSelectorLambdaBody = new ExpressionReplacingVisitor(outerState.CurrentParameter, newOuterParameter).Visit(collectionSelectorLambdaBody);
outerState.CurrentParameter = newOuterParameter;
}

if (collectionSelectorState.CurrentParameter.Name == null
&& collectionSelectorState.CurrentParameter.Name != methodCallExpression.Arguments[2].UnwrapQuote().Parameters[1].Name)
{
var newInnerParameter = Expression.Parameter(collectionSelectorState.CurrentParameter.Type, methodCallExpression.Arguments[2].UnwrapQuote().Parameters[1].Name);
collectionSelectorState.PendingSelector = (LambdaExpression)new ExpressionReplacingVisitor(collectionSelectorState.CurrentParameter, newInnerParameter).Visit(collectionSelectorState.PendingSelector);
collectionSelectorState.CurrentParameter = newInnerParameter;
}
}

if (methodCallExpression.Method.MethodIsClosedFormOf(LinqMethodHelpers.QueryableSelectManyWithResultOperatorMethodInfo)
&& (collectionSelectorState.CurrentParameter.Name == null
|| collectionSelectorState.CurrentParameter.Name != methodCallExpression.Arguments[2].UnwrapQuote().Parameters[1].Name))
&& collectionSelectorState.CurrentParameter.Name != methodCallExpression.Arguments[2].UnwrapQuote().Parameters[1].Name)
{
// TODO: should we rename the second parameter according to the second parameter of the result selector instead?
var newParameter = Expression.Parameter(collectionSelectorState.CurrentParameter.Type, methodCallExpression.Arguments[2].UnwrapQuote().Parameters[1].Name);
@@ -404,7 +382,7 @@ private NavigationExpansionExpressionState CreateSelectManyInnerState(Navigation
sourceMappingMapping[oldSourceMapping] = newSourceMapping;
var newNavigationTreeRoot = NavigationTreeNode.CreateRoot(newSourceMapping, new List<string>(), oldSourceMapping.NavigationTree.Optional);

// TODO: simply coyping ToMapping might not be correct for very complex cases where the child mapping is not purely Inner/Outer but has some properties from preivous anonymous projections
// TODO: simply copying ToMapping might not be correct for very complex cases where the child mapping is not purely Inner/Outer but has some properties from previous anonymous projections
// we should recognize and filter those out, however this is theoretical at this point - scenario is not supported and likely won't be in the foreseeable future
newNavigationTreeRoot.ToMapping = oldSourceMapping.NavigationTree.ToMapping.ToList();
newSourceMapping.NavigationTree = newNavigationTreeRoot;
@@ -451,7 +429,7 @@ private void CopyNavigationTree(
copy.ExpansionMode = child.ExpansionMode;
copy.Included = child.Included;

// TODO: simply coyping ToMapping might not be correct for very complex cases where the child mapping is not purely Inner/Outer but has some properties from preivous anonymous projections
// TODO: simply copying ToMapping might not be correct for very complex cases where the child mapping is not purely Inner/Outer but has some properties from previous anonymous projections
// we should recognize and filter those out, however this is theoretical at this point - scenario is not supported and likely won't be in the foreseeable future
copy.ToMapping = child.ToMapping.ToList();
mapping[child] = copy;
@@ -461,11 +439,11 @@ private void CopyNavigationTree(

private class SelectManyCollectionPendingSelectorRemapper : ExpressionVisitor
{
private ParameterExpression _oldParameter;
private ParameterExpression _newParameter;
private Dictionary<SourceMapping, SourceMapping> _sourceMappingMapping;
private Dictionary<NavigationTreeNode, NavigationTreeNode> _navigationTreeNodeMapping;
private Dictionary<List<string>, List<string>> _customRootMappingMapping;
private readonly ParameterExpression _oldParameter;
private readonly ParameterExpression _newParameter;
private readonly Dictionary<SourceMapping, SourceMapping> _sourceMappingMapping;
private readonly Dictionary<NavigationTreeNode, NavigationTreeNode> _navigationTreeNodeMapping;
private readonly Dictionary<List<string>, List<string>> _customRootMappingMapping;

public SelectManyCollectionPendingSelectorRemapper(
ParameterExpression oldParameter,
@@ -603,7 +581,7 @@ private Expression ProcessGroupJoin(MethodCallExpression methodCallExpression)
var innerApplyOrderingsResult = ApplyPendingOrderings(innerApplyNavigationsResult.source, innerApplyNavigationsResult.state);

var resultSelectorBody = resultSelector.Body;
var remappedResultSelectorBody = ExpressionExtensions.CombineAndRemap(resultSelector.Body, resultSelector.Parameters[0], outerApplyOrderingsResult.state.PendingSelector.Body);
var remappedResultSelectorBody = resultSelector.Body.CombineAndRemap(resultSelector.Parameters[0], outerApplyOrderingsResult.state.PendingSelector.Body);

var groupingParameter = resultSelector.Parameters[1];
var newGroupingParameter = Expression.Parameter(typeof(IEnumerable<>).MakeGenericType(innerApplyOrderingsResult.state.CurrentParameter.Type), "new_" + groupingParameter.Name);
@@ -950,8 +928,8 @@ private Expression ProcessSkipTake(MethodCallExpression methodCallExpression)

private class PendingSelectorReprojector : ExpressionVisitor
{
private List<string> _currentPath = new List<string>();
private CustomRootExpression _rootExpression;
private readonly List<string> _currentPath = new List<string>();
private readonly CustomRootExpression _rootExpression;

public PendingSelectorReprojector(CustomRootExpression rootExpression)
{
@@ -1047,7 +1025,7 @@ private Expression ProcessInclude(MethodCallExpression methodCallExpression)
Expression remappedIncludeLambdaBody;
if (methodCallExpression.Method.Name == "Include")
{
remappedIncludeLambdaBody = ExpressionExtensions.CombineAndRemap(includeLambda.Body, includeLambda.Parameters[0], applyOrderingsResult.state.PendingSelector.Body);
remappedIncludeLambdaBody = includeLambda.Body.CombineAndRemap(includeLambda.Parameters[0], applyOrderingsResult.state.PendingSelector.Body);
}
else
{
@@ -1069,7 +1047,7 @@ private Expression ProcessInclude(MethodCallExpression methodCallExpression)
else
{
var pendingIncludeChainLambda = Expression.Lambda(applyOrderingsResult.state.PendingIncludeChain, applyOrderingsResult.state.CurrentParameter);
remappedIncludeLambdaBody = ExpressionExtensions.CombineAndRemap(includeLambda.Body, includeLambda.Parameters[0], pendingIncludeChainLambda.Body);
remappedIncludeLambdaBody = includeLambda.Body.CombineAndRemap(includeLambda.Parameters[0], pendingIncludeChainLambda.Body);
}
}

@@ -1244,7 +1222,7 @@ protected override Expression VisitConstant(ConstantExpression constantExpressio
return (source, lambda.Body, state);
}

var remappedLambdaBody = ExpressionExtensions.CombineAndRemap(lambda.Body, lambda.Parameters[0], state.PendingSelector.Body);
var remappedLambdaBody = lambda.Body.CombineAndRemap(lambda.Parameters[0], state.PendingSelector.Body);

var binder = new NavigationPropertyBindingVisitor(
state.PendingSelector.Parameters[0],
@@ -1306,8 +1284,8 @@ protected override Expression VisitConstant(ConstantExpression constantExpressio
NavigationExpansionExpressionState outerState,
NavigationExpansionExpressionState innerState)
{
var remappedResultSelectorBody = ExpressionExtensions.CombineAndRemap(resultSelector.Body, resultSelector.Parameters[0], outerState.PendingSelector.Body);
remappedResultSelectorBody = ExpressionExtensions.CombineAndRemap(remappedResultSelectorBody, resultSelector.Parameters[1], innerState.PendingSelector.Body);
var remappedResultSelectorBody = resultSelector.Body.CombineAndRemap(resultSelector.Parameters[0], outerState.PendingSelector.Body);
remappedResultSelectorBody = remappedResultSelectorBody.CombineAndRemap(resultSelector.Parameters[1], innerState.PendingSelector.Body);

var outerBinder = new NavigationPropertyBindingVisitor(
outerState.CurrentParameter,
@@ -1389,13 +1367,13 @@ protected override Expression VisitConstant(ConstantExpression constantExpressio

private class PendingSelectorSourceMappingGenerator : ExpressionVisitor
{
private ParameterExpression _rootParameter;
private List<string> _currentPath = new List<string>();
private IEntityType _entityTypeOverride;
private readonly ParameterExpression _rootParameter;
private readonly List<string> _currentPath = new List<string>();
private readonly IEntityType _entityTypeOverride;

public List<SourceMapping> SourceMappings = new List<SourceMapping>();
public readonly List<SourceMapping> SourceMappings = new List<SourceMapping>();

public Dictionary<NavigationBindingExpression, SourceMapping> BindingToSourceMapping
public readonly Dictionary<NavigationBindingExpression, SourceMapping> BindingToSourceMapping
= new Dictionary<NavigationBindingExpression, SourceMapping>();

public PendingSelectorSourceMappingGenerator(ParameterExpression rootParameter, IEntityType entityTypeOverride)
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@

using System;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
Original file line number Diff line number Diff line change
@@ -4,16 +4,16 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;

namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
{
public class NavigationPropertyBindingVisitor : ExpressionVisitor
{
private ParameterExpression _rootParameter;
private List<SourceMapping> _sourceMappings;
private bool _bindInclude;
private readonly ParameterExpression _rootParameter;
private readonly List<SourceMapping> _sourceMappings;
private readonly bool _bindInclude;

public NavigationPropertyBindingVisitor(
ParameterExpression rootParameter,
@@ -191,7 +191,7 @@ private Expression TryBindProperty(Expression originalExpression, Expression new
if (expression is ParameterExpression parameterExpression
&& (parameterExpression == _rootParameter))
{
var matchingCandidate = navigationTreeNodeCandidates.Where(m => m.path.Count == 0).SingleOrDefault();
var matchingCandidate = navigationTreeNodeCandidates.SingleOrDefault(m => m.path.Count == 0);

return matchingCandidate.navigationTreeNode != null
? (rootParameter: parameterExpression, matchingCandidate.navigationTreeNode)
@@ -201,7 +201,7 @@ private Expression TryBindProperty(Expression originalExpression, Expression new
if (expression is CustomRootExpression customRootExpression
&& customRootExpression.RootParameter == _rootParameter)
{
var matchingCandidate = navigationTreeNodeCandidates.Where(m => m.path.Count == 0).SingleOrDefault();
var matchingCandidate = navigationTreeNodeCandidates.SingleOrDefault(m => m.path.Count == 0);

return matchingCandidate.navigationTreeNode != null
? (rootParameter: customRootExpression.RootParameter, matchingCandidate.navigationTreeNode)
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
{
public class NavigationPropertyUnbindingVisitor : ExpressionVisitor
{
private ParameterExpression _rootParameter;
private readonly ParameterExpression _rootParameter;

public NavigationPropertyUnbindingVisitor(ParameterExpression rootParameter)
{
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors
{
Original file line number Diff line number Diff line change
@@ -8,12 +8,10 @@
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Query.NavigationExpansion;

namespace Microsoft.EntityFrameworkCore.Query.Pipeline
{
@@ -151,7 +149,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp

if (methodCallExpression.Method.DeclaringType == typeof(Queryable)
|| methodCallExpression.Method.DeclaringType == typeof(Enumerable)
|| methodCallExpression.Method.DeclaringType == typeof(EntityQueryableExtensions))
|| methodCallExpression.Method.DeclaringType == typeof(QueryableExtensions))
{
switch (methodCallExpression.Method.Name)
{
@@ -163,7 +161,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp

case nameof(Queryable.GroupJoin):
case nameof(Queryable.Join):
case nameof(EntityQueryableExtensions.LeftJoin):
case nameof(QueryableExtensions.LeftJoin):
return VisitJoinMethodCall(methodCallExpression);

case nameof(Queryable.GroupBy): // TODO: Implement
23 changes: 0 additions & 23 deletions src/EFCore/Query/Pipeline/EntityQueryableExtensions.cs

This file was deleted.

21 changes: 11 additions & 10 deletions src/EFCore/Query/Pipeline/GroupJoinFlatteningExpressionVisitor.cs
Original file line number Diff line number Diff line change
@@ -6,39 +6,40 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.Query.Pipeline
{
public class GroupJoinFlatteningExpressionVisitor : ExpressionVisitor
{
private static MethodInfo _whereMethodInfo = typeof(Queryable).GetTypeInfo()
private static readonly MethodInfo _whereMethodInfo = typeof(Queryable).GetTypeInfo()
.GetDeclaredMethods(nameof(Queryable.Where))
.Single(mi => mi.GetParameters().Length == 2
&& mi.GetParameters()[1].ParameterType.GetGenericArguments()[0].GetGenericArguments().Length == 2);

private static MethodInfo _groupJoinMethodInfo = typeof(Queryable).GetTypeInfo()
private static readonly MethodInfo _groupJoinMethodInfo = typeof(Queryable).GetTypeInfo()
.GetDeclaredMethods(nameof(Queryable.GroupJoin)).Single(mi => mi.GetParameters().Length == 5);

private static MethodInfo _defaultIfEmptyWithoutArgMethodInfo = typeof(Enumerable).GetTypeInfo()
private static readonly MethodInfo _defaultIfEmptyWithoutArgMethodInfo = typeof(Enumerable).GetTypeInfo()
.GetDeclaredMethods(nameof(Enumerable.DefaultIfEmpty)).Single(mi => mi.GetParameters().Length == 1);

private static MethodInfo _selectManyWithCollectionSelectorMethodInfo = typeof(Queryable).GetTypeInfo()
private static readonly MethodInfo _selectManyWithCollectionSelectorMethodInfo = typeof(Queryable).GetTypeInfo()
.GetDeclaredMethods(nameof(Queryable.SelectMany))
.Single(mi => mi.GetParameters().Length == 3
&& mi.GetParameters()[1].ParameterType.GetGenericArguments()[0].GetGenericArguments().Length == 2);
private static MethodInfo _selectManyWithoutCollectionSelectorMethodInfo = typeof(Queryable).GetTypeInfo()
private static readonly MethodInfo _selectManyWithoutCollectionSelectorMethodInfo = typeof(Queryable).GetTypeInfo()
.GetDeclaredMethods(nameof(Queryable.SelectMany))
.Single(mi => mi.GetParameters().Length == 2
&& mi.GetParameters()[1].ParameterType.GetGenericArguments()[0].GetGenericArguments().Length == 2);

private static MethodInfo _joinMethodInfo = typeof(Queryable).GetTypeInfo()
private static readonly MethodInfo _joinMethodInfo = typeof(Queryable).GetTypeInfo()
.GetDeclaredMethods(nameof(Queryable.Join)).Single(mi => mi.GetParameters().Length == 5);
private static MethodInfo _leftJoinMethodInfo = typeof(EntityQueryableExtensions).GetTypeInfo()
.GetDeclaredMethods(nameof(EntityQueryableExtensions.LeftJoin)).Single(mi => mi.GetParameters().Length == 5);
private static readonly MethodInfo _leftJoinMethodInfo = typeof(QueryableExtensions).GetTypeInfo()
.GetDeclaredMethods(nameof(QueryableExtensions.LeftJoin)).Single(mi => mi.GetParameters().Length == 5);

private static SelectManyVerifyingExpressionVisitor _selectManyVerifyingExpressionVisitor
private static readonly SelectManyVerifyingExpressionVisitor _selectManyVerifyingExpressionVisitor
= new SelectManyVerifyingExpressionVisitor();
private static EnumerableToQueryableReMappingExpressionVisitor _enumerableToQueryableReMappingExpressionVisitor
private static readonly EnumerableToQueryableReMappingExpressionVisitor _enumerableToQueryableReMappingExpressionVisitor
= new EnumerableToQueryableReMappingExpressionVisitor();

protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
Original file line number Diff line number Diff line change
@@ -2,13 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.NavigationExpansion.Visitors;

namespace Microsoft.EntityFrameworkCore.Query.Pipeline
@@ -26,7 +27,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
{
if (methodCallExpression.Method.DeclaringType == typeof(Queryable)
|| methodCallExpression.Method.DeclaringType == typeof(EntityQueryableExtensions))
|| methodCallExpression.Method.DeclaringType == typeof(QueryableExtensions))
{
var source = Visit(methodCallExpression.Arguments[0]);
if (source is ShapedQueryExpression shapedQueryExpression)
@@ -244,7 +245,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp

break;

case nameof(EntityQueryableExtensions.LeftJoin)
case nameof(QueryableExtensions.LeftJoin)
when argumentCount == 5:
{
var innerSource = Visit(methodCallExpression.Arguments[1]);
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

using static SQLitePCL.raw;

// ReSharper disable once CheckNamespace
namespace SQLitePCL
{
internal static class SQLitePCLExtensions
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Data.Sqlite
{
internal static class SqliteConnectionExtensions
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@

using System.Reflection;

// ReSharper disable once CheckNamespace
namespace System
{
internal static class TypeExtensions
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
using Microsoft.EntityFrameworkCore.Cosmos.TestUtilities;
using Xunit;

namespace Microsoft.EntityFrameworkCore.Cosmos.Metadata
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Metadata
{
public class CosmosBuilderExtensionsTest
{
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Xunit;

namespace Microsoft.EntityFrameworkCore
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Metadata
{
public class CosmosMetadataExtensionsTest
{
5 changes: 0 additions & 5 deletions test/EFCore.Cosmos.Tests/TestUtilities/CosmosTestHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,11 +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.

using Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.Extensions.DependencyInjection;

Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@

using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Cosmos.TestUtilities;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;

namespace Microsoft.EntityFrameworkCore.Cosmos.ValueGenerator.Internal
1 change: 1 addition & 0 deletions test/EFCore.Specification.Tests/LoadTestBase.cs
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.TestUtilities;

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Internal
{
public static class EnumerableExtensions
{
public static async Task<List<TSource>> ToListAsync<TSource>(
this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)
{
var list = new List<TSource>();
await foreach (var element in source.WithCancellation(cancellationToken))
{
list.Add(element);
}

return list;
}

public static List<TSource> ToList<TSource>(this IEnumerable source)
=> source.OfType<TSource>().ToList();
}
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.TestUtilities.QueryTestGeneration
{
@@ -20,7 +20,7 @@ public AppendIncludeToExistingExpressionMutator(DbContext context)

public override bool IsValid(Expression expression)
{
_expressionFinder = new ExpressionFinder(this);
_expressionFinder = new ExpressionFinder();
_expressionFinder.Visit(expression);

return _expressionFinder.FoundExpressions.Any();
@@ -87,13 +87,6 @@ public override Expression Apply(Expression expression, Random random)

private class ExpressionFinder : ExpressionVisitor
{
private AppendIncludeToExistingExpressionMutator _mutator;

public ExpressionFinder(AppendIncludeToExistingExpressionMutator mutator)
{
_mutator = mutator;
}

public readonly List<Expression> FoundExpressions = new List<Expression>();

protected override Expression VisitMethodCall(MethodCallExpression node)
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.TestUtilities.QueryTestGeneration
{
@@ -51,8 +51,8 @@ public override Expression Visit(Expression node)
if (_insideLambda
&& !_insideEFProperty
&& node?.Type == typeof(string)
&& node?.NodeType != ExpressionType.Parameter
&& (node?.NodeType != ExpressionType.Constant || ((ConstantExpression)node)?.Value != null))
&& node.NodeType != ExpressionType.Parameter
&& (node.NodeType != ExpressionType.Constant || ((ConstantExpression)node)?.Value != null))
{
FoundExpressions.Add(node);
}
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;

namespace Microsoft.EntityFrameworkCore.TestUtilities.QueryTestGeneration
{
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// 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.

using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Extensions.Internal;

namespace Microsoft.EntityFrameworkCore.TestUtilities
{
public static class QueryableExtensions
{
public static List<TSource> ToList<TSource>(this System.Collections.IEnumerable source)
=> source.OfType<TSource>().ToList();

public static Task<List<TSource>> ToListAsync<TSource>(this IQueryable source, CancellationToken cancellationToken = default)
{
return ((IQueryable<TSource>)source).ToListAsync(cancellationToken);
}

public static async Task<List<TSource>> ToListAsync<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)
{
var list = new List<TSource>();
await foreach (var element in source.WithCancellation(cancellationToken))
{
list.Add(element);
}

return list;
}
=> ((IQueryable<TSource>)source).ToListAsync(cancellationToken);
}
}
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con

foreach (var foreignKey in modelBuilder.Model
.GetEntityTypes()
.SelectMany(e => MutableEntityTypeExtensions.GetDeclaredForeignKeys(e))
.SelectMany(e => e.GetDeclaredForeignKeys())
.Where(e => e.DeleteBehavior == DeleteBehavior.Cascade))
{
foreignKey.DeleteBehavior = DeleteBehavior.ClientCascade;
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con

foreach (var foreignKey in modelBuilder.Model
.GetEntityTypes()
.SelectMany(e => MutableEntityTypeExtensions.GetDeclaredForeignKeys(e)))
.SelectMany(e => e.GetDeclaredForeignKeys()))
{
foreignKey.DeleteBehavior = DeleteBehavior.ClientNoAction;
}
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
Original file line number Diff line number Diff line change
@@ -3,11 +3,10 @@

using System;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.SqlServer.Design.Internal;
using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal;

namespace Microsoft.EntityFrameworkCore
namespace Microsoft.EntityFrameworkCore.Design
{
public class SqlServerDesignTimeProviderServicesTest : DesignTimeProviderServicesTest
{
3 changes: 2 additions & 1 deletion test/EFCore.Tests/ExceptionTest.cs
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.Update;
using Xunit;
// ReSharper disable InconsistentNaming

namespace Microsoft.EntityFrameworkCore
{
@@ -186,7 +187,7 @@ public FakeInternalEntityEntry()
public override object Entity { get; }
}

private static IEntityType CreateEntityType()
private static IEntityType CreateEntityType()
{
var model = new Model(new ConventionSet());
var entityType = model.AddEntityType(typeof(object), ConfigurationSource.Convention);
3 changes: 2 additions & 1 deletion test/EFCore.Tests/Extensions/PropertyExtensionsTest.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,8 @@
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;

namespace Microsoft.EntityFrameworkCore.Extensions
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
public class PropertyExtensionsTest
{
5 changes: 3 additions & 2 deletions test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs
Original file line number Diff line number Diff line change
@@ -9,14 +9,15 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Extensions.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
using Xunit;

// ReSharper disable InconsistentNaming
// ReSharper disable RedundantArgumentDefaultValue
namespace Microsoft.EntityFrameworkCore.Extensions
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
public class QueryableExtensionsTest
{
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace Microsoft.EntityFrameworkCore.Extensions
// ReSharper disable InconsistentNaming
namespace Microsoft.EntityFrameworkCore
{
public class ServiceProviderExtensionsTest
{