Skip to content

Commit

Permalink
Make postgres subscription provider compatible with npgsql 8 (#6686)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Staib <[email protected]>
  • Loading branch information
PascalSenn and michaelstaib authored Nov 10, 2023
1 parent b6eb805 commit 1cbb038
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Data;
using System.Threading.Channels;
using HotChocolate.Subscriptions.Diagnostics;
using Npgsql;
Expand Down Expand Up @@ -100,8 +101,16 @@ private async Task HandleMessage(NpgsqlConnection connection, CancellationToken

command.CommandText = "SELECT pg_notify(@channel, @message);";

command.Parameters.Add(new NpgsqlParameter("channel", _channelName));
command.Parameters.Add(new NpgsqlParameter("message", message.FormattedPayload));
var channel = new NpgsqlParameter("channel", DbType.String)
{
Value = _channelName
};
var msg = new NpgsqlParameter("message", DbType.String)
{
Value = message.FormattedPayload
};
command.Parameters.Add(channel);
command.Parameters.Add(msg);

batch.BatchCommands.Add(command);
}
Expand Down

0 comments on commit 1cbb038

Please sign in to comment.