本文整理汇总了C#中Npgsql.NpgsqlConnector.AddNotificationThread方法的典型用法代码示例。如果您正苦于以下问题:C# NpgsqlConnector.AddNotificationThread方法的具体用法?C# NpgsqlConnector.AddNotificationThread怎么用?C# NpgsqlConnector.AddNotificationThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Npgsql.NpgsqlConnector
的用法示例。
在下文中一共展示了NpgsqlConnector.AddNotificationThread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Open
/// <summary>
/// Opens a database connection with the property settings specified by the
/// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
/// </summary>
public override void Open()
{
CheckConnectionClosed();
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");
// Check if there is any missing argument.
if (!settings.ContainsKey(Keywords.Host))
{
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"),
NpgsqlConnectionStringBuilder.GetKeyName(Keywords.Host));
}
if (!settings.ContainsKey(Keywords.UserName) && !settings.ContainsKey(Keywords.IntegratedSecurity))
{
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"),
NpgsqlConnectionStringBuilder.GetKeyName(Keywords.UserName));
}
// Get a Connector. The connector returned is guaranteed to be connected and ready to go.
connector = NpgsqlConnectorPool.ConnectorPoolMgr.RequestConnector(this);
connector.Notice += NoticeDelegate;
connector.Notification += NotificationDelegate;
if (SyncNotification)
{
connector.AddNotificationThread();
}
if (Enlist)
{
Promotable.Enlist(Transaction.Current);
}
}
示例2: Open
/// <summary>
/// Opens a database connection with the property settings specified by the
/// <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>.
/// </summary>
public void Open()
{
CheckConnectionClosed();
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");
// Check if there is any missing argument.
if (! connection_string.Contains(ConnectionStringKeys.Host))
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.Host);
if (! connection_string.Contains(ConnectionStringKeys.UserName))
throw new ArgumentException(resman.GetString("Exception_MissingConnStrArg"), ConnectionStringKeys.UserName);
// Get a Connector. The connector returned is guaranteed to be connected and ready to go.
connector = NpgsqlConnectorPool.ConnectorPoolMgr.RequestConnector (this);
connector.Notice += NoticeDelegate;
connector.Notification += NotificationDelegate;
if (SyncNotification)
connector.AddNotificationThread();
}