本文整理汇总了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);
}
}
}