c# - Npgsql 命令超时值; 0是不确定的吗?

标签 c# visual-studio-2010 npgsql

我还没有真正找到任何明确说明这一点的内容。如果我在 npgsql 中为连接对象设置 Commandtimeout 值,是否会将其设置为无限期等待?

最佳答案

是的,0 是无限的。

Npgqlstate.cs 包含下面的代码作为 context.Mediator.CommandTimeout > 0 因此,如果 CommandTimeout 为 0,Npgsql 将永远等待。

internal IEnumerable<IServerResponseObject> ProcessBackendResponsesEnum(NpgsqlConnector context,
    bool cancelRequestCalled)
{
    try
    {
    // Process commandTimeout behavior.

    if ((context.Mediator.CommandTimeout > 0) &&
            (!CheckForContextSocketAvailability(context, SelectMode.SelectRead)))

关于c# - Npgsql 命令超时值; 0是不确定的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15661112/

相关文章:

c# - 为什么 AngleSharp 不为交错文本生成 TextNodes?

visual-studio-2010 - 查找VS2012项目中有多少行代码

c++ - 将循环转移到 C++03 for_each

asp.net - ODBC 或 NpgSQL for ASP.NET 使用 PostgreSQL

javascript - 如何从ajax调用MVC Controller 获取数据?

c# - 在 WPF RichTextBox 中将特定文本设置为粗体

vb.net - VB : How to bind a DataTable to a DataGridView?

postgresql - 使用 Dapper 和 Npgsql 插入 Postgres 日期范围

c# - 生成 .ADO.net 实体数据模型时,postgresql 未出现在数据源中

javascript - 从代码隐藏中打开确认对话框