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

Final API review polish changes #17166

Merged
merged 1 commit into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 class EntityProjectionExpression : Expression, IPrintable, IAccessExpression
public class EntityProjectionExpression : Expression, IPrintableExpression, IAccessExpression
{
private readonly IDictionary<IProperty, IAccessExpression> _propertyExpressionsCache
= new Dictionary<IProperty, IAccessExpression>();
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/ObjectAccessExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 class ObjectAccessExpression : Expression, IPrintable, IAccessExpression
public class ObjectAccessExpression : Expression, IPrintableExpression, IAccessExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 class ObjectArrayProjectionExpression : Expression, IPrintable, IAccessExpression
public class ObjectArrayProjectionExpression : Expression, IPrintableExpression, IAccessExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/OrderingExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 class OrderingExpression : Expression, IPrintable
public class OrderingExpression : Expression, IPrintableExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/ProjectionExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 class ProjectionExpression : Expression, IPrintable
public class ProjectionExpression : Expression, IPrintableExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/SqlExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
/// 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 abstract class SqlExpression : Expression, IPrintable
public abstract class SqlExpression : Expression, IPrintableExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static IServiceCollection AddEntityFrameworkInMemoryDatabase([NotNull] th
// New Query pipeline
.TryAdd<IShapedQueryCompilingExpressionVisitorFactory, InMemoryShapedQueryCompilingExpressionVisitorFactory>()
.TryAdd<IQueryableMethodTranslatingExpressionVisitorFactory, InMemoryQueryableMethodTranslatingExpressionVisitorFactory>()
.TryAdd<IShapedQueryOptimizerFactory, InMemoryShapedQueryOptimizerFactory>()
.TryAdd<IQueryTranslationPostprocessorFactory, InMemoryQueryTranslationPostprocessorFactory>()

.TryAdd<ISingletonOptions, IInMemorySingletonOptions>(p => p.GetService<IInMemorySingletonOptions>())
.TryAddProviderSpecificServices(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

namespace Microsoft.EntityFrameworkCore.InMemory.Query.Internal
{
public class InMemoryShapedQueryOptimizer : ShapedQueryOptimizer
public class InMemoryQueryTranslationPostprocessor : QueryTranslationPostprocessor
{
public InMemoryShapedQueryOptimizer(ShapedQueryOptimizerDependencies dependencies)
public InMemoryQueryTranslationPostprocessor(QueryTranslationPostprocessorDependencies dependencies)
: base(dependencies)
{
}

public override Expression Visit(Expression query)
public override Expression Process(Expression query)
{
query = base.Visit(query);
query = base.Process(query);

return query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ namespace Microsoft.EntityFrameworkCore.InMemory.Query.Internal
/// This service cannot depend on services registered as <see cref="ServiceLifetime.Scoped" />.
/// </para>
/// </summary>
public class InMemoryShapedQueryOptimizerFactory : IShapedQueryOptimizerFactory
public class InMemoryQueryTranslationPostprocessorFactory : IQueryTranslationPostprocessorFactory
{
private readonly ShapedQueryOptimizerDependencies _dependencies;
private readonly QueryTranslationPostprocessorDependencies _dependencies;

public InMemoryShapedQueryOptimizerFactory(ShapedQueryOptimizerDependencies dependencies)
public InMemoryQueryTranslationPostprocessorFactory(QueryTranslationPostprocessorDependencies dependencies)
{
_dependencies = dependencies;
}

public virtual ShapedQueryOptimizer Create(QueryCompilationContext queryCompilationContext)
public virtual QueryTranslationPostprocessor Create(QueryCompilationContext queryCompilationContext)
{
return new InMemoryShapedQueryOptimizer(_dependencies);
return new InMemoryQueryTranslationPostprocessor(_dependencies);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static void IncludeReference<TEntity, TIncludingEntity, TIncludedEntity>
// For non-null relatedEntity StateManager will set the flag
if (relatedEntity == null)
{
queryContext.StateManager.TryGetEntry(includingEntity).SetIsLoaded(navigation);
queryContext.SetIsLoaded(includingEntity, navigation);
}
}
else
Expand Down Expand Up @@ -94,7 +94,7 @@ private static void IncludeCollection<TEntity, TIncludingEntity, TIncludedEntity
collectionAccessor.Add(includingEntity, relatedEntity, forMaterialization: true);
}

queryContext.StateManager.TryGetEntry(includingEntity).SetIsLoaded(navigation);
queryContext.SetIsLoaded(includingEntity, navigation);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices()
TryAdd<IQueryableMethodTranslatingExpressionVisitorFactory, RelationalQueryableMethodTranslatingExpressionVisitorFactory>();
TryAdd<IMethodCallTranslatorProvider, RelationalMethodCallTranslatorProvider>();
TryAdd<IMemberTranslatorProvider, RelationalMemberTranslatorProvider>();
TryAdd<IShapedQueryOptimizerFactory, RelationalShapedQueryOptimizerFactory>();
TryAdd<IQueryTranslationPostprocessorFactory, RelationalQueryTranslationPostprocessorFactory>();
TryAdd<IRelationalSqlTranslatingExpressionVisitorFactory, RelationalSqlTranslatingExpressionVisitorFactory>();
TryAdd<ISqlExpressionFactory, SqlExpressionFactory>();
TryAdd<IQueryOptimizerFactory, RelationalQueryOptimizerFactory>();
TryAdd<IQueryTranslationPreprocessorFactory, RelationalQueryTranslationPreprocessorFactory>();

ServiceCollectionMap.GetInfrastructure()
.AddDependencySingleton<RelationalSqlGenerationHelperDependencies>()
Expand All @@ -184,9 +184,9 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices()
.AddDependencySingleton<RelationalQueryableMethodTranslatingExpressionVisitorDependencies>()
.AddDependencySingleton<QuerySqlGeneratorDependencies>()
.AddDependencySingleton<RelationalShapedQueryCompilingExpressionVisitorDependencies>()
.AddDependencySingleton<RelationalShapedQueryOptimizerDependencies>()
.AddDependencySingleton<RelationalQueryTranslationPostprocessorDependencies>()
.AddDependencySingleton<RelationalEvaluatableExpressionFilterDependencies>()
.AddDependencySingleton<RelationalQueryOptimizerDependencies>()
.AddDependencySingleton<RelationalQueryTranslationPreprocessorDependencies>()
.AddDependencyScoped<MigrationsSqlGeneratorDependencies>()
.AddDependencyScoped<RelationalConventionSetBuilderDependencies>()
.AddDependencyScoped<ModificationCommandBatchFactoryDependencies>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;

namespace Microsoft.EntityFrameworkCore.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.EntityFrameworkCore.Query
{
public class CollectionInitializingExpression : Expression, IPrintable
public class CollectionInitializingExpression : Expression, IPrintableExpression
{
public CollectionInitializingExpression(
int collectionId, Expression parent, Expression parentIdentifier, Expression outerIdentifier, INavigation navigation, Type type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.EntityFrameworkCore.Query
{
public class CollectionPopulatingExpression : Expression, IPrintable
public class CollectionPopulatingExpression : Expression, IPrintableExpression
{
public CollectionPopulatingExpression(RelationalCollectionShaperExpression parent, Type type, bool include)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal
{
/// <summary>
/// <para>
/// A factory for creating <see cref="ShapedQueryOptimizer"/> instances.
/// A factory for creating <see cref="QueryTranslationPostprocessor"/> instances.
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime.Singleton"/>. This means a single instance
/// is used by many <see cref="DbContext"/> instances. The implementation must be thread-safe.
/// This service cannot depend on services registered as <see cref="ServiceLifetime.Scoped"/>.
/// </para>
/// </summary>
public class RelationalShapedQueryOptimizerFactory : IShapedQueryOptimizerFactory
public class RelationalQueryTranslationPostprocessorFactory : IQueryTranslationPostprocessorFactory
{
private readonly ShapedQueryOptimizerDependencies _dependencies;
private readonly RelationalShapedQueryOptimizerDependencies _relationalDependencies;
private readonly QueryTranslationPostprocessorDependencies _dependencies;
private readonly RelationalQueryTranslationPostprocessorDependencies _relationalDependencies;

public RelationalShapedQueryOptimizerFactory(
ShapedQueryOptimizerDependencies dependencies,
RelationalShapedQueryOptimizerDependencies relationalDependencies)
public RelationalQueryTranslationPostprocessorFactory(
QueryTranslationPostprocessorDependencies dependencies,
RelationalQueryTranslationPostprocessorDependencies relationalDependencies)
{
_dependencies = dependencies;
_relationalDependencies = relationalDependencies;
}

public virtual ShapedQueryOptimizer Create(QueryCompilationContext queryCompilationContext)
public virtual QueryTranslationPostprocessor Create(QueryCompilationContext queryCompilationContext)
{
return new RelationalShapedQueryOptimizer(
return new RelationalQueryTranslationPostprocessor(
_dependencies,
_relationalDependencies,
queryCompilationContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal
{
/// <summary>
/// <para>
/// A factory for creating <see cref="RelationalQueryOptimizer"/> instances.
/// A factory for creating <see cref="RelationalQueryTranslationPreprocessor"/> instances.
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime.Singleton"/>. This means a single instance
/// is used by many <see cref="DbContext"/> instances. The implementation must be thread-safe.
/// This service cannot depend on services registered as <see cref="ServiceLifetime.Scoped"/>.
/// </para>
/// </summary>
public class RelationalQueryOptimizerFactory : IQueryOptimizerFactory
public class RelationalQueryTranslationPreprocessorFactory : IQueryTranslationPreprocessorFactory
{
private readonly QueryOptimizerDependencies _dependencies;
private readonly RelationalQueryOptimizerDependencies _relationalDependencies;
private readonly QueryTranslationPreprocessorDependencies _dependencies;
private readonly RelationalQueryTranslationPreprocessorDependencies _relationalDependencies;

public RelationalQueryOptimizerFactory(
QueryOptimizerDependencies dependencies,
RelationalQueryOptimizerDependencies relationalDependencies)
public RelationalQueryTranslationPreprocessorFactory(
QueryTranslationPreprocessorDependencies dependencies,
RelationalQueryTranslationPreprocessorDependencies relationalDependencies)
{
_dependencies = dependencies;
_relationalDependencies = relationalDependencies;
}

public virtual QueryOptimizer Create(QueryCompilationContext queryCompilationContext)
=> new RelationalQueryOptimizer(_dependencies, _relationalDependencies, queryCompilationContext);
public virtual QueryTranslationPreprocessor Create(QueryCompilationContext queryCompilationContext)
=> new RelationalQueryTranslationPreprocessor(_dependencies, _relationalDependencies, queryCompilationContext);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Microsoft.EntityFrameworkCore.Query
{
public class RelationalCollectionShaperExpression : Expression, IPrintable
public class RelationalCollectionShaperExpression : Expression, IPrintableExpression
{
public RelationalCollectionShaperExpression(
int collectionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace Microsoft.EntityFrameworkCore.Query
{
public class RelationalShapedQueryOptimizer : ShapedQueryOptimizer
public class RelationalQueryTranslationPostprocessor : QueryTranslationPostprocessor
{
private readonly SqlExpressionOptimizingExpressionVisitor _sqlExpressionOptimizingExpressionVisitor;

public RelationalShapedQueryOptimizer(
ShapedQueryOptimizerDependencies dependencies,
RelationalShapedQueryOptimizerDependencies relationalDependencies,
public RelationalQueryTranslationPostprocessor(
QueryTranslationPostprocessorDependencies dependencies,
RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
QueryCompilationContext queryCompilationContext)
: base(dependencies)
{
Expand All @@ -24,15 +24,15 @@ public RelationalShapedQueryOptimizer(
= new SqlExpressionOptimizingExpressionVisitor(SqlExpressionFactory, UseRelationalNulls);
}

protected virtual RelationalShapedQueryOptimizerDependencies RelationalDependencies { get; }
protected virtual RelationalQueryTranslationPostprocessorDependencies RelationalDependencies { get; }

protected virtual ISqlExpressionFactory SqlExpressionFactory { get; }

protected virtual bool UseRelationalNulls { get; }

public override Expression Visit(Expression query)
public override Expression Process(Expression query)
{
query = base.Visit(query);
query = base.Process(query);
query = new SelectExpressionProjectionApplyingExpressionVisitor().Visit(query);
query = new CollectionJoinApplyingExpressionVisitor().Visit(query);
query = new TableAliasUniquifyingExpressionVisitor().Visit(query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore.Query
{
/// <summary>
/// <para>
/// Service dependencies parameter class for <see cref="RelationalShapedQueryOptimizer" />
/// Service dependencies parameter class for <see cref="RelationalQueryTranslationPostprocessor" />
/// </para>
/// <para>
/// This type is typically used by database providers (and other extensions). It is generally
Expand All @@ -30,11 +30,11 @@ namespace Microsoft.EntityFrameworkCore.Query
/// This service cannot depend on services registered as <see cref="ServiceLifetime.Scoped"/>.
/// </para>
/// </summary>
public sealed class RelationalShapedQueryOptimizerDependencies
public sealed class RelationalQueryTranslationPostprocessorDependencies
{
/// <summary>
/// <para>
/// Creates the service dependencies parameter object for a <see cref="RelationalShapedQueryOptimizer" />.
/// Creates the service dependencies parameter object for a <see cref="RelationalQueryTranslationPostprocessor" />.
/// </para>
/// <para>
/// Do not call this constructor directly from either provider or application code as it may change
Expand All @@ -52,7 +52,7 @@ public sealed class RelationalShapedQueryOptimizerDependencies
/// </para>
/// </summary>
[EntityFrameworkInternal]
public RelationalShapedQueryOptimizerDependencies(
public RelationalQueryTranslationPostprocessorDependencies(
[NotNull] ISqlExpressionFactory sqlExpressionFactory)
{
SqlExpressionFactory = sqlExpressionFactory;
Expand All @@ -69,7 +69,7 @@ public RelationalShapedQueryOptimizerDependencies(
/// </summary>
/// <param name="sqlExpressionFactory"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public RelationalShapedQueryOptimizerDependencies With([NotNull] ISqlExpressionFactory sqlExpressionFactory)
=> new RelationalShapedQueryOptimizerDependencies(sqlExpressionFactory);
public RelationalQueryTranslationPostprocessorDependencies With([NotNull] ISqlExpressionFactory sqlExpressionFactory)
=> new RelationalQueryTranslationPostprocessorDependencies(sqlExpressionFactory);
}
}
Loading