Skip to content

Query: API Cleanup #20767

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 28, 2020
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
78 changes: 0 additions & 78 deletions src/EFCore.Relational/Query/CollectionInitializingExpression.cs

This file was deleted.

52 changes: 0 additions & 52 deletions src/EFCore.Relational/Query/CollectionPopulatingExpression.cs

This file was deleted.

8 changes: 4 additions & 4 deletions src/EFCore.Relational/Query/EntityProjectionExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public EntityProjectionExpression([NotNull] IEntityType entityType, [NotNull] ID
_propertyExpressionsCache = propertyExpressions;
}

public virtual IEntityType EntityType { get; }
public sealed override ExpressionType NodeType => ExpressionType.Extension;
public override Type Type => EntityType.ClrType;

protected override Expression VisitChildren(ExpressionVisitor visitor)
{
Check.NotNull(visitor, nameof(visitor));
Expand Down Expand Up @@ -109,10 +113,6 @@ public virtual EntityProjectionExpression UpdateEntityType([NotNull] IEntityType
return new EntityProjectionExpression(derivedType, propertyExpressionCache);
}

public virtual IEntityType EntityType { get; }
public sealed override ExpressionType NodeType => ExpressionType.Extension;
public override Type Type => EntityType.ClrType;

public virtual ColumnExpression BindProperty([NotNull] IProperty property)
{
Check.NotNull(property, nameof(property));
Expand Down
26 changes: 17 additions & 9 deletions src/EFCore.Relational/Query/ISqlExpressionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ namespace Microsoft.EntityFrameworkCore.Query
/// </summary>
public interface ISqlExpressionFactory
{
SqlExpression ApplyTypeMapping([CanBeNull] SqlExpression sqlExpression, [CanBeNull] RelationalTypeMapping typeMapping);
SqlExpression ApplyDefaultTypeMapping([CanBeNull] SqlExpression sqlExpression);
[Obsolete("Use IRelationalTypeMappingSource directly.")]
RelationalTypeMapping GetTypeMappingForValue([CanBeNull] object value);
[Obsolete("Use IRelationalTypeMappingSource directly.")]
RelationalTypeMapping FindMapping([NotNull] Type type);
SqlExpression ApplyTypeMapping([CanBeNull] SqlExpression sqlExpression, [CanBeNull] RelationalTypeMapping typeMapping);
SqlExpression ApplyDefaultTypeMapping([CanBeNull] SqlExpression sqlExpression);

SqlUnaryExpression MakeUnary(
ExpressionType operatorType,
Expand All @@ -43,9 +45,13 @@ SqlBinaryExpression MakeBinary(

// Comparison
SqlBinaryExpression Equal([NotNull] SqlExpression left, [NotNull] SqlExpression right);

SqlBinaryExpression NotEqual([NotNull] SqlExpression left, [NotNull] SqlExpression right);

SqlBinaryExpression GreaterThan([NotNull] SqlExpression left, [NotNull] SqlExpression right);

SqlBinaryExpression GreaterThanOrEqual([NotNull] SqlExpression left, [NotNull] SqlExpression right);

SqlBinaryExpression LessThan([NotNull] SqlExpression left, [NotNull] SqlExpression right);

SqlBinaryExpression LessThanOrEqual([NotNull] SqlExpression left, [NotNull] SqlExpression right);
Expand Down Expand Up @@ -109,28 +115,30 @@ SqlFunctionExpression Function(
[NotNull] Type returnType,
[CanBeNull] RelationalTypeMapping typeMapping = null);

[Obsolete("Use overload that explicitly specifies value for 'argumentsPropagateNullability' argument.")]
[Obsolete("Use overload that explicitly specifies value for 'instancePropagatesNullability' and 'argumentsPropagateNullability' arguments.")]
SqlFunctionExpression Function(
[CanBeNull] SqlExpression instance,
[NotNull] SqlExpression instance,
[NotNull] string name,
[NotNull] IEnumerable<SqlExpression> arguments,
[NotNull] Type returnType,
[CanBeNull] RelationalTypeMapping typeMapping = null);

[Obsolete("Use overload that explicitly specifies value for 'nullable' argument.")]
SqlFunctionExpression Function(
[NotNull] string name,
[NotNull] Type returnType,
[CanBeNull] RelationalTypeMapping typeMapping = null);

[Obsolete("Use overload that explicitly specifies value for 'nullable' argument.")]
SqlFunctionExpression Function(
[NotNull] string schema,
[NotNull] string name,
[NotNull] Type returnType,
[CanBeNull] RelationalTypeMapping typeMapping = null);

[Obsolete("Use overload that explicitly specifies value for 'argumentsPropagateNullability' argument.")]
[Obsolete("Use overload that explicitly specifies value for 'instancePropagatesNullability' argument.")]
SqlFunctionExpression Function(
[CanBeNull] SqlExpression instance,
[NotNull] SqlExpression instance,
[NotNull] string name,
[NotNull] Type returnType,
[CanBeNull] RelationalTypeMapping typeMapping = null);
Expand All @@ -144,7 +152,7 @@ SqlFunctionExpression Function(
[CanBeNull] RelationalTypeMapping typeMapping = null);

SqlFunctionExpression Function(
[CanBeNull] string schema,
[NotNull] string schema,
[NotNull] string name,
[NotNull] IEnumerable<SqlExpression> arguments,
bool nullable,
Expand All @@ -153,7 +161,7 @@ SqlFunctionExpression Function(
[CanBeNull] RelationalTypeMapping typeMapping = null);

SqlFunctionExpression Function(
[CanBeNull] SqlExpression instance,
[NotNull] SqlExpression instance,
[NotNull] string name,
[NotNull] IEnumerable<SqlExpression> arguments,
bool nullable,
Expand All @@ -176,7 +184,7 @@ SqlFunctionExpression Function(
[CanBeNull] RelationalTypeMapping typeMapping = null);

SqlFunctionExpression Function(
[CanBeNull] SqlExpression instance,
[NotNull] SqlExpression instance,
[NotNull] string name,
bool nullable,
bool instancePropagatesNullability,
Expand Down
19 changes: 12 additions & 7 deletions src/EFCore.Relational/Query/Internal/CollateTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@

using System.Collections.Generic;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.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 CollateTranslator : IMethodCallTranslator
{
private static readonly MethodInfo _methodInfo
= typeof(RelationalDbFunctionsExtensions).GetMethod(nameof(RelationalDbFunctionsExtensions.Collate));

private readonly ISqlExpressionFactory _sqlExpressionFactory;

public CollateTranslator([NotNull] ISqlExpressionFactory 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 virtual SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadOnlyList<SqlExpression> arguments)
{
Check.NotNull(method, nameof(method));
Expand Down
Loading