本文整理匯總了C#中Npgsql.NpgsqlConnector.PrependBackendTimeoutMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# NpgsqlConnector.PrependBackendTimeoutMessage方法的具體用法?C# NpgsqlConnector.PrependBackendTimeoutMessage怎麽用?C# NpgsqlConnector.PrependBackendTimeoutMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Npgsql.NpgsqlConnector
的用法示例。
在下文中一共展示了NpgsqlConnector.PrependBackendTimeoutMessage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ValidateAndCreateMessages
internal void ValidateAndCreateMessages(CommandBehavior behavior = CommandBehavior.Default)
{
_connector = Connection.Connector;
foreach (NpgsqlParameter p in Parameters.Where(p => p.IsInputDirection)) {
p.Bind(_connector.TypeHandlerRegistry);
if (p.LengthCache != null) {
p.LengthCache.Clear();
}
p.ValidateAndGetLength();
}
// For prepared SchemaOnly queries, we already have the RowDescriptions from the Prepare phase.
// No need to send anything
if (IsPrepared && (behavior & CommandBehavior.SchemaOnly) != 0) {
return;
}
// Set the frontend timeout
_connector.UserCommandFrontendTimeout = CommandTimeout;
// If needed, prepend a "SET statement_timeout" message to set the backend timeout
_connector.PrependBackendTimeoutMessage(CommandTimeout);
// Create actual messages depending on scenario
if (IsPrepared) {
CreateMessagesPrepared(behavior);
} else {
if ((behavior & CommandBehavior.SchemaOnly) == 0) {
CreateMessagesNonPrepared(behavior);
} else {
CreateMessagesSchemaOnly(behavior);
}
}
}