Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class SqlServerSqlNullabilityProcessor : SqlNullabilityProcessor
{
private const int MaxParameterCount = 2100;

private static readonly bool UseOldBehavior37151 =
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue37151", out var enabled) && enabled;

/// <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
Expand Down Expand Up @@ -291,7 +294,8 @@ protected override int CalculateParameterBucketSize(int count, RelationalTypeMap
<= 750 => 50,
<= 2000 => 100,
<= 2070 => 10, // try not to over-pad as we approach that limit
<= MaxParameterCount => 0, // just don't pad between 2070 and 2100, to minimize the crazy
<= MaxParameterCount when UseOldBehavior37151 => 0,
<= MaxParameterCount => 1, // just don't pad between 2070 and 2100, to minimize the crazy
_ => 200,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,16 @@ SELECT COUNT(*)
""");
}

[ConditionalFact]
public virtual async Task Parameter_collection_of_ints_Contains_int_2071_values()
{
var ints = Enumerable.Repeat(10, 2071).ToArray();
await AssertQuery(ss => ss.Set<PrimitiveCollectionsEntity>().Where(c => ints.Contains(c.Int)));

// check that 2071 parameter is the last one (and no error happened)
Assert.Contains("@ints2071)", Fixture.TestSqlLoggerFactory.SqlStatements[0], StringComparison.Ordinal);
}

[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
Expand Down