Skip to content

Commit

Permalink
Fragment translators are boring
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Mar 11, 2019
1 parent b055e94 commit 932d624
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Microsoft.EntityFrameworkCore.Migrations.Internal;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Expressions;
using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators;
using Microsoft.EntityFrameworkCore.Query.ExpressionVisitors;
using Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal;
using Microsoft.EntityFrameworkCore.Query.Internal;
Expand Down Expand Up @@ -71,7 +70,6 @@ public static readonly IDictionary<Type, ServiceCharacteristics> RelationalServi
{ typeof(IShaperCommandContextFactory), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(IConditionalRemovingExpressionVisitorFactory), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(ISelectExpressionFactory), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(IExpressionFragmentTranslator), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(ISqlTranslatingExpressionVisitorFactory), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(IUpdateSqlGenerator), new ServiceCharacteristics(ServiceLifetime.Singleton) },
{ typeof(IQuerySqlGeneratorFactory), new ServiceCharacteristics(ServiceLifetime.Singleton) },
Expand Down Expand Up @@ -168,7 +166,6 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices()
TryAdd<IEntityQueryModelVisitorFactory, RelationalQueryModelVisitorFactory>();
TryAdd<IProjectionExpressionVisitorFactory, RelationalProjectionExpressionVisitorFactory>();
TryAdd<ICompiledQueryCacheKeyGenerator, RelationalCompiledQueryCacheKeyGenerator>();
TryAdd<IExpressionFragmentTranslator, RelationalCompositeExpressionFragmentTranslator>();
TryAdd<ISqlTranslatingExpressionVisitorFactory, SqlTranslatingExpressionVisitorFactory>();
TryAdd<INamedConnectionStringResolver, NamedConnectionStringResolver>();
TryAdd<ReLinq.IEvaluatableExpressionFilter, ReLinqRelationalEvaluatableExpressionFilter>();
Expand All @@ -188,7 +185,6 @@ public override EntityFrameworkServicesBuilder TryAddCoreServices()
ServiceCollectionMap.GetInfrastructure()
.AddDependencySingleton<RelationalSqlGenerationHelperDependencies>()
.AddDependencySingleton<RelationalTypeMappingSourceDependencies>()
.AddDependencySingleton<RelationalCompositeExpressionFragmentTranslatorDependencies>()
.AddDependencySingleton<RelationalModelValidatorDependencies>()
.AddDependencySingleton<UpdateSqlGeneratorDependencies>()
.AddDependencySingleton<QuerySqlGeneratorDependencies>()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query.Expressions;
using Microsoft.EntityFrameworkCore.Query.Expressions.Internal;
using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators;
using Microsoft.EntityFrameworkCore.Query.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;
Expand Down Expand Up @@ -41,7 +40,6 @@ private static readonly Dictionary<ExpressionType, ExpressionType> _inverseOpera
{ ExpressionType.NotEqual, ExpressionType.Equal }
};

private readonly IExpressionFragmentTranslator _compositeExpressionFragmentTranslator;
private readonly RelationalQueryModelVisitor _queryModelVisitor;
private readonly IRelationalTypeMappingSource _typeMappingSource;
private readonly SelectExpression _targetSelectExpression;
Expand Down Expand Up @@ -70,7 +68,6 @@ public SqlTranslatingExpressionVisitor(
Check.NotNull(dependencies, nameof(dependencies));
Check.NotNull(queryModelVisitor, nameof(queryModelVisitor));

_compositeExpressionFragmentTranslator = dependencies.CompositeExpressionFragmentTranslator;
_typeMappingSource = dependencies.TypeMappingSource;
_queryModelVisitor = queryModelVisitor;
_targetSelectExpression = targetSelectExpression;
Expand Down Expand Up @@ -98,14 +95,6 @@ public SqlTranslatingExpressionVisitor(
/// </returns>
public override Expression Visit(Expression expression)
{
var translatedExpression = _compositeExpressionFragmentTranslator.Translate(expression);

if (translatedExpression != null
&& translatedExpression != expression)
{
return Visit(translatedExpression);
}

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (expression != null
&& (expression.NodeType == ExpressionType.Convert
Expand Down
Loading

0 comments on commit 932d624

Please sign in to comment.