本文整理匯總了C#中Npgsql.NpgsqlConnector.BlockNotificationThread方法的典型用法代碼示例。如果您正苦於以下問題:C# NpgsqlConnector.BlockNotificationThread方法的具體用法?C# NpgsqlConnector.BlockNotificationThread怎麽用?C# NpgsqlConnector.BlockNotificationThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Npgsql.NpgsqlConnector
的用法示例。
在下文中一共展示了NpgsqlConnector.BlockNotificationThread方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ExecuteBlindSuppressTimeout
internal static void ExecuteBlindSuppressTimeout(NpgsqlConnector connector, NpgsqlQuery query)
{
// Block the notification thread before writing anything to the wire.
using (var blocker = connector.BlockNotificationThread())
{
// Write the Query message to the wire.
connector.Query(query);
// Flush, and wait for and discard all responses.
connector.ProcessAndDiscardBackendResponses();
}
}
示例2: ExecuteBlind
private static void ExecuteBlind(NpgsqlConnector connector, NpgsqlQuery query, int timeout)
{
// Block the notification thread before writing anything to the wire.
using (var blocker = connector.BlockNotificationThread())
{
// Set statement timeout as needed.
connector.SetBackendCommandTimeout(timeout);
// Write the Query message to the wire.
connector.Query(query);
// Flush, and wait for and discard all responses.
connector.ProcessAndDiscardBackendResponses();
}
}