using System;
using Npgsql.Internal;
namespace Npgsql;
///
/// Provides information on a PostgreSQL notification. Notifications are sent when your connection has registered for
/// notifications on a specific channel via the LISTEN command. NOTIFY can be used to generate such notifications,
/// allowing for an inter-connection communication channel.
///
public sealed class NpgsqlNotificationEventArgs : EventArgs
{
///
/// Process ID of the PostgreSQL backend that sent this notification.
///
// ReSharper disable once InconsistentNaming
public int PID { get; }
///
/// The channel on which the notification was sent.
///
public string Channel { get; }
///
/// An optional payload string that was sent with this notification.
///
public string Payload { get; }
///
/// The channel on which the notification was sent.
///
[Obsolete("Use Channel instead")]
public string Condition => Channel;
///
/// An optional payload string that was sent with this notification.
///
[Obsolete("Use Payload instead")]
public string AdditionalInformation => Payload;
internal NpgsqlNotificationEventArgs(NpgsqlReadBuffer buf)
{
PID = buf.ReadInt32();
Channel = buf.ReadNullTerminatedString();
Payload = buf.ReadNullTerminatedString();
}
}