Setting command timeout using NpgsqlConnection

Connection string

This Npgsql connection string can be used for connections to PostgreSQL.

Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;
Password
=myPassword;
CommandTimeout=20;

The CommandTimeout parameter is measured in seconds and controls for how long to wait for a command to finish before throwing an error.