From 6231a79a4b6fe2a0daf3cfbb4f363d88a5e81a6d Mon Sep 17 00:00:00 2001 From: XiaoYang Date: Sun, 12 Dec 2021 14:56:11 +0800 Subject: [PATCH] Fix some compilation time warning --- .../ParameterExtractingExpressionVisitor.cs | 5 +++-- src/MySql/EFCore.Bulk.MySql-3.1.csproj | 2 ++ .../EFCore.Bulk.PostgreSql-3.1.csproj | 2 ++ .../Provider/ParameterBasedSqlProcessor.cs | 6 +----- src/Relational/Reduce/ColumnRewritingVisitor.cs | 8 -------- ...ProjectionBindingPruningExpressionVisitor.cs | 17 ----------------- .../ShaperQueryExpressionReplacingVisitor.cs | 2 ++ src/SqlServer/EFCore.Bulk.SqlServer-3.1.csproj | 3 +++ src/SqlServer/EFCore.Bulk.SqlServer-5.0.csproj | 1 + ...eryableMethodTranslatingExpressionVisitor.cs | 6 +----- src/Sqlite/EFCore.Bulk.Sqlite-3.1.csproj | 2 ++ 11 files changed, 17 insertions(+), 37 deletions(-) diff --git a/src/Abstraction/Query/ParameterExtractingExpressionVisitor.cs b/src/Abstraction/Query/ParameterExtractingExpressionVisitor.cs index 2432880..4c14b99 100644 --- a/src/Abstraction/Query/ParameterExtractingExpressionVisitor.cs +++ b/src/Abstraction/Query/ParameterExtractingExpressionVisitor.cs @@ -603,7 +603,10 @@ private sealed class EvaluatableExpressionFindingExpressionVisitor : ExpressionV private readonly IEvaluatableExpressionFilter _evaluatableExpressionFilter; private readonly ISet _allowedParameters = new HashSet(); private readonly IModel _model; + +#if EFCORE50 || EFCORE60 private readonly bool _parameterize; +#endif private bool _evaluatable; private bool _containsClosure; @@ -619,8 +622,6 @@ public EvaluatableExpressionFindingExpressionVisitor( _model = model; #if EFCORE50 || EFCORE60 _parameterize = parameterize; -#elif EFCORE31 - _parameterize = false; #endif } diff --git a/src/MySql/EFCore.Bulk.MySql-3.1.csproj b/src/MySql/EFCore.Bulk.MySql-3.1.csproj index e5b2e58..c20ae74 100644 --- a/src/MySql/EFCore.Bulk.MySql-3.1.csproj +++ b/src/MySql/EFCore.Bulk.MySql-3.1.csproj @@ -10,6 +10,8 @@ + + diff --git a/src/PostgreSql/EFCore.Bulk.PostgreSql-3.1.csproj b/src/PostgreSql/EFCore.Bulk.PostgreSql-3.1.csproj index 2a59499..1970136 100644 --- a/src/PostgreSql/EFCore.Bulk.PostgreSql-3.1.csproj +++ b/src/PostgreSql/EFCore.Bulk.PostgreSql-3.1.csproj @@ -10,6 +10,8 @@ + + diff --git a/src/Relational/Provider/ParameterBasedSqlProcessor.cs b/src/Relational/Provider/ParameterBasedSqlProcessor.cs index bd9d2a0..893273b 100644 --- a/src/Relational/Provider/ParameterBasedSqlProcessor.cs +++ b/src/Relational/Provider/ParameterBasedSqlProcessor.cs @@ -1,6 +1,4 @@ -#if EFCORE50 || EFCORE60 - -using Microsoft.EntityFrameworkCore.Bulk; +using Microsoft.EntityFrameworkCore.Bulk; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using Microsoft.EntityFrameworkCore.Utilities; using System.Collections.Generic; @@ -286,5 +284,3 @@ public virtual RelationalParameterBasedSqlProcessor Create(bool useRelationalNul => new RelationalBulkParameterBasedSqlProcessor(_dependencies, useRelationalNulls, _options); } } - -#endif diff --git a/src/Relational/Reduce/ColumnRewritingVisitor.cs b/src/Relational/Reduce/ColumnRewritingVisitor.cs index d19c619..1ba84c1 100644 --- a/src/Relational/Reduce/ColumnRewritingVisitor.cs +++ b/src/Relational/Reduce/ColumnRewritingVisitor.cs @@ -45,14 +45,6 @@ public IDisposable Setup(TableReferenceExpression from, TableReferenceExpression return new ResettingDisposable(this); } -#if EFCORE60 - [Obsolete] - public IDisposable Setup(TableExpressionBase from, TableExpressionBase to) - { - throw new NotImplementedException(); - } -#endif - public IDisposable Setup(TableReferenceExpression from, IReadOnlyDictionary to) { _from = Check.NotNull(from, nameof(from)); diff --git a/src/Relational/Reduce/ProjectionBindingPruningExpressionVisitor.cs b/src/Relational/Reduce/ProjectionBindingPruningExpressionVisitor.cs index d91ec9c..f6909de 100644 --- a/src/Relational/Reduce/ProjectionBindingPruningExpressionVisitor.cs +++ b/src/Relational/Reduce/ProjectionBindingPruningExpressionVisitor.cs @@ -107,23 +107,6 @@ protected virtual Expression VisitProjectionBinding(ProjectionBindingExpression } } - return projectionBindingExpression; - } -#elif EFCORE60 - else if (projectionBindingExpression.IndexMap != null) - { - var links = projectionBindingExpression.IndexMap; - if (_processed.Add((IDictionary)links)) - { - var properties = links.ToList(); - foreach (var link in properties) - { - var rawIndex = link.Value; - var property = link.Key; - ((IDictionary)links)[property] = _remappedIndex[rawIndex]; - } - } - return projectionBindingExpression; } #endif diff --git a/src/Relational/Reduce/ShaperQueryExpressionReplacingVisitor.cs b/src/Relational/Reduce/ShaperQueryExpressionReplacingVisitor.cs index bbace49..4241f20 100644 --- a/src/Relational/Reduce/ShaperQueryExpressionReplacingVisitor.cs +++ b/src/Relational/Reduce/ShaperQueryExpressionReplacingVisitor.cs @@ -25,10 +25,12 @@ protected override Expression VisitExtension(Expression node) { return new ProjectionBindingExpression(_new, proj.ProjectionMember, proj.Type); } +#if EFCORE31 || EFCORE50 else if (proj.IndexMap != null) { return new ProjectionBindingExpression(_new, proj.IndexMap); } +#endif } return node == _origin ? _new : base.VisitExtension(node); diff --git a/src/SqlServer/EFCore.Bulk.SqlServer-3.1.csproj b/src/SqlServer/EFCore.Bulk.SqlServer-3.1.csproj index 939d511..116c38d 100644 --- a/src/SqlServer/EFCore.Bulk.SqlServer-3.1.csproj +++ b/src/SqlServer/EFCore.Bulk.SqlServer-3.1.csproj @@ -10,6 +10,9 @@ + + + diff --git a/src/SqlServer/EFCore.Bulk.SqlServer-5.0.csproj b/src/SqlServer/EFCore.Bulk.SqlServer-5.0.csproj index fe1a152..6a6584e 100644 --- a/src/SqlServer/EFCore.Bulk.SqlServer-5.0.csproj +++ b/src/SqlServer/EFCore.Bulk.SqlServer-5.0.csproj @@ -10,6 +10,7 @@ + diff --git a/src/SqlServer/QueryableMethodTranslatingExpressionVisitor.cs b/src/SqlServer/QueryableMethodTranslatingExpressionVisitor.cs index da4fe59..4fc1d08 100644 --- a/src/SqlServer/QueryableMethodTranslatingExpressionVisitor.cs +++ b/src/SqlServer/QueryableMethodTranslatingExpressionVisitor.cs @@ -1,6 +1,4 @@ -#if EFCORE60 - -using Microsoft.EntityFrameworkCore.Bulk; +using Microsoft.EntityFrameworkCore.Bulk; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal; @@ -100,5 +98,3 @@ public QueryableMethodTranslatingExpressionVisitor Create(QueryCompilationContex _anonymousExpressionFactory); } } - -#endif \ No newline at end of file diff --git a/src/Sqlite/EFCore.Bulk.Sqlite-3.1.csproj b/src/Sqlite/EFCore.Bulk.Sqlite-3.1.csproj index 4381aeb..39cbf39 100644 --- a/src/Sqlite/EFCore.Bulk.Sqlite-3.1.csproj +++ b/src/Sqlite/EFCore.Bulk.Sqlite-3.1.csproj @@ -10,6 +10,8 @@ + +