Skip to content

Commit

Permalink
Merge branch 'release/5.0-preview8'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Jul 18, 2020
2 parents 1aac0ae + d2b9f32 commit 644d3c8
Show file tree
Hide file tree
Showing 91 changed files with 2,411 additions and 718 deletions.
43 changes: 0 additions & 43 deletions src/EFCore.Cosmos/Query/CosmosQueryTranslationPostprocessor.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// 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.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.Cosmos.Query.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 class CosmosQueryTranslationPostprocessor : QueryTranslationPostprocessor
{
private readonly ISqlExpressionFactory _sqlExpressionFactory;

/// <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 CosmosQueryTranslationPostprocessor(
[NotNull] QueryTranslationPostprocessorDependencies dependencies,
[NotNull] ISqlExpressionFactory sqlExpressionFactory,
[NotNull] QueryCompilationContext queryCompilationContext)
: base(dependencies, queryCompilationContext)
{
Check.NotNull(sqlExpressionFactory, nameof(sqlExpressionFactory));

_sqlExpressionFactory = sqlExpressionFactory;
}

/// <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 override Expression Process(Expression query)
{
query = base.Process(query);
query = new CosmosValueConverterCompensatingExpressionVisitor(_sqlExpressionFactory).Visit(query);

return query;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public CosmosProjectionBindingRemovingExpressionVisitor(
{
_selectExpression = selectExpression;
}

protected override ProjectionExpression GetProjection(ProjectionBindingExpression projectionBindingExpression)
=> _selectExpression.Projection[GetProjectionIndex(projectionBindingExpression)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,16 @@ MethodInfo GetMethod()
return new EntityReferenceExpression(subqueryTranslation);
}

var shaperExpression = subqueryTranslation.ShaperExpression;
if (shaperExpression is UnaryExpression unaryExpression
&& unaryExpression.NodeType == ExpressionType.Convert
&& unaryExpression.Type.MakeNullable() == unaryExpression.Operand.Type)
{
shaperExpression = unaryExpression.Operand;
}

#pragma warning disable IDE0046 // Convert to conditional expression
if (!(subqueryTranslation.ShaperExpression is ProjectionBindingExpression projectionBindingExpression))
if (!(shaperExpression is ProjectionBindingExpression projectionBindingExpression))
#pragma warning restore IDE0046 // Convert to conditional expression
{
return null;
Expand Down Expand Up @@ -869,7 +877,6 @@ private Expression TryBindMember(Expression source, MemberIdentity member, Type
if (property != null)
{
return BindProperty(entityReferenceExpression, property, type);

}

AddTranslationErrorDetails(
Expand Down
Loading

0 comments on commit 644d3c8

Please sign in to comment.