未验证 提交 37567673 编写于 作者: S Shay Rojansky 提交者: GitHub

Sync dependencies (#2315)

EF Core -> 7.0.0-preview.4.22176.1

Switched to dotnet sdk 7.0.100-preview.4.22175.5, because preview2 has
an issue (https://github.com/dotnet/runtime/issues/66056)
上级 0e7b0899
......@@ -11,7 +11,7 @@ on:
pull_request:
env:
dotnet_sdk_version: '6.0.x'
dotnet_sdk_version: '7.0.100-preview.4.22175.5'
postgis_version: 3
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
......
<Project>
<PropertyGroup>
<EFCoreVersion>7.0.0-preview.3.22175.1</EFCoreVersion>
<EFCoreVersion>7.0.0-preview.4.22176.1</EFCoreVersion>
<MicrosoftExtensionsVersion>7.0.0-preview.3.22175.4</MicrosoftExtensionsVersion>
<NpgsqlVersion>7.0.0-preview.2</NpgsqlVersion>
</PropertyGroup>
......
{
"sdk": {
"version": "6.0.100",
"version": "7.0.100-preview.4.22175.5",
"rollForward": "latestMajor",
"allowPrerelease": "false"
"allowPrerelease": "true"
}
}
......@@ -17,28 +17,23 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal;
/// </remarks>
public class NpgsqlModificationCommandBatch : ReaderModificationCommandBatch
{
private const int DefaultBatchSize = 1000;
private readonly int _maxBatchSize;
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlModificationCommandBatch"/> class.
/// </summary>
public NpgsqlModificationCommandBatch(
ModificationCommandBatchFactoryDependencies dependencies,
int? maxBatchSize)
int maxBatchSize)
: base(dependencies)
{
if (maxBatchSize is <= 0)
{
throw new ArgumentOutOfRangeException(nameof(maxBatchSize), RelationalStrings.InvalidMaxBatchSize(maxBatchSize));
}
=> MaxBatchSize = maxBatchSize;
_maxBatchSize = maxBatchSize ?? DefaultBatchSize;
}
/// <summary>
/// The maximum number of <see cref="ModificationCommand"/> instances that can be added to a single batch; defaults to 1000.
/// </summary>
protected override int MaxBatchSize { get; }
/// <inheritdoc />
protected override bool IsValid()
=> ModificationCommands.Count <= _maxBatchSize && ParameterValues.Count <= ushort.MaxValue;
=> ParameterValues.Count <= ushort.MaxValue;
protected override void Consume(RelationalDataReader reader)
{
......
......@@ -4,8 +4,10 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal;
public class NpgsqlModificationCommandBatchFactory : IModificationCommandBatchFactory
{
private const int DefaultMaxBatchSize = 1000;
private readonly ModificationCommandBatchFactoryDependencies _dependencies;
private readonly IDbContextOptions _options;
private readonly int _maxBatchSize;
public NpgsqlModificationCommandBatchFactory(
ModificationCommandBatchFactoryDependencies dependencies,
......@@ -15,13 +17,16 @@ public class NpgsqlModificationCommandBatchFactory : IModificationCommandBatchFa
Check.NotNull(options, nameof(options));
_dependencies = dependencies;
_options = options;
}
public virtual ModificationCommandBatch Create()
{
var optionsExtension = _options.Extensions.OfType<NpgsqlOptionsExtension>().FirstOrDefault();
_maxBatchSize = options.Extensions.OfType<NpgsqlOptionsExtension>().FirstOrDefault()?.MaxBatchSize ?? DefaultMaxBatchSize;
return new NpgsqlModificationCommandBatch(_dependencies, optionsExtension?.MaxBatchSize);
if (_maxBatchSize <= 0)
{
throw new ArgumentOutOfRangeException(
nameof(RelationalOptionsExtension.MaxBatchSize), RelationalStrings.InvalidMaxBatchSize(_maxBatchSize));
}
}
}
\ No newline at end of file
public virtual ModificationCommandBatch Create()
=> new NpgsqlModificationCommandBatch(_dependencies, _maxBatchSize);
}
......@@ -3,6 +3,8 @@
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<!-- There's lots of use of internal EF Core APIs from the tests, suppress the analyzer warnings for those -->
<NoWarn>$(NoWarn);xUnit1003;xUnit1004;xUnit1013;EF1001</NoWarn>
</PropertyGroup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册