Skip to content

Commit 68d132f

Browse files
committed
Fixup merge and remove quirks
1 parent 5061e06 commit 68d132f

21 files changed

+10
-383
lines changed

src/EFCore.Cosmos/Metadata/Conventions/CosmosValueGenerationConvention.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ public CosmosValueGenerationConvention(
2727
{
2828
}
2929

30-
private static readonly bool _useOldBehavior31664 =
31-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31664", out var enabled31664) && enabled31664;
32-
3330
/// <summary>
3431
/// Called after an annotation is changed on an entity type.
3532
/// </summary>
@@ -83,7 +80,7 @@ public virtual void ProcessEntityTypeAnnotationChanged(
8380
if (pk != null
8481
&& !property.IsForeignKey()
8582
&& pk.Properties.Count == ownership.Properties.Count + 1
86-
&& (property.IsShadowProperty() || _useOldBehavior31664)
83+
&& property.IsShadowProperty()
8784
&& ownership.Properties.All(fkProperty => pk.Properties.Contains(fkProperty)))
8885
{
8986
return ValueGenerated.OnAddOrUpdate;

src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal;
1515

1616
public partial class CosmosShapedQueryCompilingExpressionVisitor
1717
{
18-
private static readonly bool _useOldBehavior32363 =
19-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32363", out var enabled32363) && enabled32363;
20-
2118
private abstract class CosmosProjectionBindingRemovingExpressionVisitorBase : ExpressionVisitor
2219
{
2320
private static readonly MethodInfo GetItemMethodInfo

src/EFCore.Relational/Query/QuerySqlGenerator.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public class QuerySqlGenerator : SqlExpressionVisitor
4141
private IRelationalCommandBuilder _relationalCommandBuilder;
4242
private Dictionary<string, int>? _repeatedParameterCounts;
4343

44-
private static readonly bool UseOldBehavior32375 =
45-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32375", out var enabled32375) && enabled32375;
46-
4744
/// <summary>
4845
/// Creates a new instance of the <see cref="QuerySqlGenerator" /> class.
4946
/// </summary>

src/EFCore.Relational/Query/SqlExpressionFactory.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ namespace Microsoft.EntityFrameworkCore.Query;
1010
/// <inheritdoc />
1111
public class SqlExpressionFactory : ISqlExpressionFactory
1212
{
13-
private static readonly bool UseOldBehavior32325 =
14-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32325", out var enabled32325) && enabled32325;
15-
1613
private readonly IRelationalTypeMappingSource _typeMappingSource;
1714
private readonly RelationalTypeMapping _boolTypeMapping;
1815

src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ namespace Microsoft.EntityFrameworkCore.Migrations;
2929
/// </remarks>
3030
public class SqlServerMigrationsSqlGenerator : MigrationsSqlGenerator
3131
{
32-
private static readonly bool UseOldBehavior32457 =
33-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32457", out var enabled32457) && enabled32457;
34-
3532
private IReadOnlyList<MigrationOperation> _operations = null!;
3633
private int _variableCounter;
3734

src/EFCore.SqlServer/Query/Internal/SqlServerQueryableMethodTranslatingExpressionVisitor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ public class SqlServerQueryableMethodTranslatingExpressionVisitor : RelationalQu
2525

2626
private RelationalTypeMapping? _nvarcharMaxTypeMapping;
2727

28-
private static readonly bool UseOldBehavior32374 =
29-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32374", out var enabled32374) && enabled32374;
30-
3128
/// <summary>
3229
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
3330
/// the same compatibility standards as public APIs. It may be changed or removed without notice in

src/EFCore.SqlServer/Query/Internal/SqlServerSqlTranslatingExpressionVisitor.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public class SqlServerSqlTranslatingExpressionVisitor : RelationalSqlTranslating
2020
private readonly SqlServerQueryCompilationContext _queryCompilationContext;
2121
private readonly ISqlExpressionFactory _sqlExpressionFactory;
2222

23-
private static readonly bool UseOldBehavior32432 =
24-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32432", out var enabled32432) && enabled32432;
25-
2623
private static readonly HashSet<string> DateTimeDataTypes
2724
= new()
2825
{
@@ -282,10 +279,8 @@ when patternParameter.Name.StartsWith(QueryCompilationContext.QueryParameterPref
282279
Expression.Constant(methodType)),
283280
QueryCompilationContext.QueryContextParameter);
284281

285-
var escapedPatternParameter = UseOldBehavior32432
286-
? _queryCompilationContext.RegisterRuntimeParameter(
287-
$"{patternParameter.Name}_{methodType.ToString().ToLower(CultureInfo.InvariantCulture)}", lambda)
288-
: _queryCompilationContext.RegisterRuntimeParameter(
282+
var escapedPatternParameter =
283+
_queryCompilationContext.RegisterRuntimeParameter(
289284
$"{patternParameter.Name}_{methodType.ToString().ToLower(CultureInfo.InvariantCulture)}", lambda);
290285

291286
translation = _sqlExpressionFactory.Like(

src/EFCore.Sqlite.Core/Query/Internal/SqliteSqlTranslatingExpressionVisitor.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ private static readonly IReadOnlyDictionary<ExpressionType, IReadOnlyCollection<
9696
{ typeof(float), "mod" }
9797
};
9898

99-
private static readonly bool UseOldBehavior32432 =
100-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32432", out var enabled32432) && enabled32432;
101-
10299
/// <summary>
103100
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
104101
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -331,10 +328,8 @@ when patternParameter.Name.StartsWith(QueryCompilationContext.QueryParameterPref
331328
Expression.Constant(startsWith)),
332329
QueryCompilationContext.QueryContextParameter);
333330

334-
var escapedPatternParameter = UseOldBehavior32432
335-
? _queryCompilationContext.RegisterRuntimeParameter(
336-
$"{patternParameter.Name}_{(startsWith ? "startswith" : "endswith")}", lambda)
337-
: _queryCompilationContext.RegisterRuntimeParameter(
331+
var escapedPatternParameter =
332+
_queryCompilationContext.RegisterRuntimeParameter(
338333
$"{patternParameter.Name}_{(startsWith ? "startswith" : "endswith")}", lambda);
339334

340335
translation = _sqlExpressionFactory.Like(

src/EFCore/ChangeTracking/Internal/NavigationFixer.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
1414
/// </summary>
1515
public class NavigationFixer : INavigationFixer
1616
{
17-
private static readonly bool UseOldBehavior32383 =
18-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32383", out var enabled32383) && enabled32383;
19-
2017
private IList<(
2118
InternalEntityEntry Entry,
2219
InternalEntityEntry OtherEntry,
@@ -1441,36 +1438,6 @@ private void ConditionallyNullForeignKeyProperties(
14411438
_inFixup = false;
14421439
}
14431440
}
1444-
else
1445-
{
1446-
if (foreignKey.IsRequired
1447-
&& hasOnlyKeyProperties
1448-
&& dependentEntry.EntityState != EntityState.Detached)
1449-
{
1450-
try
1451-
{
1452-
_inFixup = true;
1453-
switch (dependentEntry.EntityState)
1454-
{
1455-
case EntityState.Added:
1456-
dependentEntry.SetEntityState(EntityState.Detached);
1457-
DeleteFixup(dependentEntry);
1458-
break;
1459-
case EntityState.Unchanged:
1460-
case EntityState.Modified:
1461-
dependentEntry.SetEntityState(
1462-
dependentEntry.SharedIdentityEntry != null ? EntityState.Detached : EntityState.Deleted);
1463-
DeleteFixup(dependentEntry);
1464-
break;
1465-
}
1466-
}
1467-
finally
1468-
{
1469-
_inFixup = false;
1470-
}
1471-
}
1472-
1473-
}
14741441
}
14751442

14761443
private static bool CanOverrideCurrentValue(

src/EFCore/Infrastructure/Internal/LazyLoader.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure.Internal;
1616
/// </summary>
1717
public class LazyLoader : ILazyLoader, IInjectableService
1818
{
19-
private static readonly bool UseOldBehavior32390 =
20-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32390", out var enabled32390) && enabled32390;
21-
2219
private QueryTrackingBehavior? _queryTrackingBehavior;
2320
private bool _disposed;
2421
private bool _detached;
@@ -194,9 +191,7 @@ public bool Equals((object Entity, string NavigationName) x, (object Entity, str
194191
&& string.Equals(x.NavigationName, y.NavigationName, StringComparison.Ordinal);
195192

196193
public int GetHashCode((object Entity, string NavigationName) obj)
197-
=> UseOldBehavior32390
198-
? HashCode.Combine(RuntimeHelpers.GetHashCode(obj.Entity), obj.NavigationName.GetHashCode())
199-
: HashCode.Combine(RuntimeHelpers.GetHashCode(obj.Entity), obj.NavigationName.GetHashCode());
194+
=> HashCode.Combine(RuntimeHelpers.GetHashCode(obj.Entity), obj.NavigationName.GetHashCode());
200195
}
201196

202197
private bool ShouldLoad(object entity, string navigationName, [NotNullWhen(true)] out NavigationEntry? navigationEntry)

src/EFCore/Metadata/Conventions/ConventionSet.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,12 +950,6 @@ public virtual void Add(IConvention convention)
950950
{
951951
ElementTypeAnnotationChangedConventions.Add(elementTypeAnnotationChangedConvention);
952952
}
953-
954-
if (!ElementTypeChangedConvention.UseOldBehavior32411
955-
&& convention is IPropertyElementTypeChangedConvention elementTypeChangedConvention)
956-
{
957-
PropertyElementTypeChangedConventions.Add(elementTypeChangedConvention);
958-
}
959953
}
960954

961955
/// <summary>

src/EFCore/Metadata/Conventions/Infrastructure/ProviderConventionSetBuilder.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ public virtual ConventionSet CreateConventionSet()
103103
conventionSet.Add(new ElementMappingConvention(Dependencies));
104104
conventionSet.Add(new ElementTypeChangedConvention(Dependencies));
105105

106-
if (!ElementTypeChangedConvention.UseOldBehavior32411)
107-
{
108-
conventionSet.Add(new ElementTypeChangedConvention(Dependencies));
109-
}
110-
111106
return conventionSet;
112107
}
113108

src/EFCore/Metadata/Internal/InternalPropertyBuilder.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal;
1717
public class InternalPropertyBuilder
1818
: InternalPropertyBaseBuilder<IConventionPropertyBuilder, Property>, IConventionPropertyBuilder
1919
{
20-
internal static readonly bool UseOldBehavior32430 =
21-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32430", out var enabled32430) && enabled32430;
22-
2320
/// <summary>
2421
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
2522
/// the same compatibility standards as public APIs. It may be changed or removed without notice in

src/EFCore/Properties/CoreStrings.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,6 @@
486486
<data name="EFParameterInvoked" xml:space="preserve">
487487
<value>The EF.Parameter&lt;T&gt; method may only be used within Entity Framework LINQ queries.</value>
488488
</data>
489-
<data name="EFConstantInvoked" xml:space="preserve">
490-
<value>The EF.Constant&lt;T&gt; method may only be used within Entity Framework LINQ queries.</value>
491-
</data>
492-
<data name="EFConstantWithNonEvaluableArgument" xml:space="preserve">
493-
<value>The EF.Constant&lt;T&gt; method may only be used with an argument that can be evaluated client-side and does not contain any reference to database-side entities.</value>
494-
</data>
495489
<data name="EmptyComplexType" xml:space="preserve">
496490
<value>Complex type '{complexType}' has no properties defines. Configure at least one property or don't include this type in the model.</value>
497491
</data>

src/EFCore/Query/Internal/NavigationExpandingExpressionVisitor.cs

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal;
1515
/// </summary>
1616
public partial class NavigationExpandingExpressionVisitor : ExpressionVisitor
1717
{
18-
private static readonly bool UseOldBehavior32217 =
19-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32217", out var enabled32217) && enabled32217;
20-
21-
private static readonly bool UseOldBehavior32312 =
22-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32312", out var enabled32312) && enabled32312;
23-
24-
private static readonly bool UseOldBehavior32331 =
25-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32331", out var enabled32331) && enabled32331;
26-
2718
private static readonly PropertyInfo QueryContextContextPropertyInfo
2819
= typeof(QueryContext).GetTypeInfo().GetDeclaredProperty(nameof(QueryContext.Context))!;
2920

@@ -942,10 +933,7 @@ private Expression ProcessContains(NavigationExpansionExpression source, Express
942933
source = (NavigationExpansionExpression)_pendingSelectorExpandingExpressionVisitor.Visit(source);
943934
var queryable = Reduce(source);
944935

945-
if (!UseOldBehavior32217)
946-
{
947-
item = Visit(item);
948-
}
936+
item = Visit(item);
949937

950938
return Expression.Call(QueryableMethods.Contains.MakeGenericMethod(queryable.Type.GetSequenceType()), queryable, item);
951939
}
@@ -990,10 +978,7 @@ private NavigationExpansionExpression ProcessSkipTake(
990978
MethodInfo genericMethod,
991979
Expression count)
992980
{
993-
if (!UseOldBehavior32312)
994-
{
995-
count = Visit(count);
996-
}
981+
count = Visit(count);
997982

998983
source.UpdateSource(Expression.Call(genericMethod.MakeGenericMethod(source.SourceElementType), source.Source, count));
999984

@@ -1033,10 +1018,7 @@ private NavigationExpansionExpression ProcessElementAt(
10331018
source.ApplySelector(Expression.Convert(source.PendingSelector, returnType));
10341019
}
10351020

1036-
if (!UseOldBehavior32312)
1037-
{
1038-
index = Visit(index);
1039-
}
1021+
index = Visit(index);
10401022

10411023
source.ConvertToSingleResult(genericMethod, index);
10421024

@@ -1601,10 +1583,7 @@ private GroupByNavigationExpansionExpression ProcessSkipTake(
16011583
MethodInfo genericMethod,
16021584
Expression count)
16031585
{
1604-
if (!UseOldBehavior32312)
1605-
{
1606-
count = Visit(count);
1607-
}
1586+
count = Visit(count);
16081587

16091588
groupBySource.UpdateSource(
16101589
Expression.Call(genericMethod.MakeGenericMethod(groupBySource.SourceElementType), groupBySource.Source, count));

src/EFCore/Query/Internal/ParameterExtractingExpressionVisitor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public class ParameterExtractingExpressionVisitor : ExpressionVisitor
2828
private IDictionary<Expression, bool> _evaluatableExpressions;
2929
private IQueryProvider? _currentQueryProvider;
3030

31-
private static readonly bool UseOldBehavior31552 =
32-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31552", out var enabled31552) && enabled31552;
33-
3431
/// <summary>
3532
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
3633
/// the same compatibility standards as public APIs. It may be changed or removed without notice in

src/EFCore/Storage/CoreTypeMapping.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ namespace Microsoft.EntityFrameworkCore.Storage;
2424
/// </remarks>
2525
public abstract class CoreTypeMapping
2626
{
27-
private static readonly bool UseOldBehavior32376 =
28-
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue32376", out var enabled32376) && enabled32376;
29-
3027
/// <summary>
3128
/// Parameter object for use in the <see cref="CoreTypeMapping" /> hierarchy.
3229
/// </summary>

0 commit comments

Comments
 (0)