Skip to content

Commit

Permalink
Depend on Npgsql 6.0.0-preview7
Browse files Browse the repository at this point in the history
(cherry picked from commit af1ef24)
  • Loading branch information
roji committed Aug 16, 2021
1 parent dc91502 commit 1b0b321
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<EFCoreVersion>6.0.0-preview.7.21378.4</EFCoreVersion>
<MicrosoftExtensionsVersion>6.0.0-preview.7.21377.19</MicrosoftExtensionsVersion>
<NpgsqlVersion>6.0.0-preview6</NpgsqlVersion>
<NpgsqlVersion>6.0.0-preview7</NpgsqlVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,4 +26,4 @@
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageVersion Include="GitHubActionsTestLogger" Version="1.2.0" />
</ItemGroup>
</Project>
</Project>
12 changes: 12 additions & 0 deletions src/EFCore.PG/Update/Internal/NpgsqlModificationCommandBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ protected override bool IsCommandTextValid()
protected override void Consume(RelationalDataReader reader)
{
var npgsqlReader = (NpgsqlDataReader)reader.DbDataReader;

#pragma warning disable 618
Debug.Assert(npgsqlReader.Statements.Count == ModificationCommands.Count, $"Reader has {npgsqlReader.Statements.Count} statements, expected {ModificationCommands.Count}");
#pragma warning restore 618

var commandIndex = 0;

try
Expand All @@ -89,13 +93,15 @@ protected override void Consume(RelationalDataReader reader)
// make sure they executed
for (; commandIndex < nextPropagating; commandIndex++)
{
#pragma warning disable 618
if (npgsqlReader.Statements[commandIndex].Rows == 0)
{
throw new DbUpdateConcurrencyException(
RelationalStrings.UpdateConcurrencyException(1, 0),
ModificationCommands[commandIndex].Entries
);
}
#pragma warning restore 618
}

if (nextPropagating == ModificationCommands.Count)
Expand Down Expand Up @@ -139,7 +145,11 @@ protected override async Task ConsumeAsync(
CancellationToken cancellationToken = default)
{
var npgsqlReader = (NpgsqlDataReader)reader.DbDataReader;

#pragma warning disable 618
Debug.Assert(npgsqlReader.Statements.Count == ModificationCommands.Count, $"Reader has {npgsqlReader.Statements.Count} statements, expected {ModificationCommands.Count}");
#pragma warning restore 618

var commandIndex = 0;

try
Expand All @@ -158,13 +168,15 @@ protected override async Task ConsumeAsync(
// make sure they executed
for (; commandIndex < nextPropagating; commandIndex++)
{
#pragma warning disable 618
if (npgsqlReader.Statements[commandIndex].Rows == 0)
{
throw new DbUpdateConcurrencyException(
RelationalStrings.UpdateConcurrencyException(1, 0),
ModificationCommands[commandIndex].Entries
);
}
#pragma warning restore 618
}

if (nextPropagating == ModificationCommands.Count)
Expand Down

0 comments on commit 1b0b321

Please sign in to comment.