Skip to content

Is it possible to add keyword "Command Timeout" to the connection string #614

Closed

Description

@Georgy-Losenkov

Right now the only way to override default value of SqlCommand.CommandTimeout is to do this in code.
It would be nice to do this through connection string/ConnectionStringBuilder/Connection.

Activity

  1. cheenamalhotra commented on Jun 18, 2020

    @cheenamalhotra
    Member

    Hi @Georgy-Losenkov

    I believe it should be possible, we'll keep that noted for future enhancements.

  2. roji commented on Jun 19, 2020

    @roji
    Member

    For reference, Npgsql has this.

  3. ErikEJ commented on Aug 30, 2020

    @ErikEJ
    Contributor

    Would you consider a community PR for this?

  4. ErikEJ commented on Aug 30, 2020

    @ErikEJ
    Contributor

    @roji Can you point me to how you are prioritizing CommandTimeout set via the Connection string vs CommanTimeout set in code?

  5. roji commented on Aug 30, 2020

    @roji
    Member

    In Npgsql, the programmatic NpgsqlCommand.CommandTimeout takes precedence over the connection string parameter - as a general rule, programmatic access always overrides connection string parameters (as they can be more specific).

  6. ErikEJ commented on Aug 30, 2020

    @ErikEJ
    Contributor

    @roji Thanks! Will try the same with SqlCommand. Nice #regions 😁

  7. ErikEJ commented on Aug 31, 2020

    @ErikEJ
    Contributor

    API proposal:

    SqlConnectionStringBuilder: public int CommandTimeout { get; set; }
    
    SqlConnection: public int CommandTimeout { get; }
    

    SqlCommand will use same precedence logic as here

  8. cheenamalhotra commented on Aug 31, 2020

    @cheenamalhotra
    Member

    Would you consider a community PR for this?

    @ErikEJ That would be great!
    As for us, it isn't in the top priority list as of now.

  9. ErikEJ commented on Aug 31, 2020

    @ErikEJ
    Contributor

    I will look into it, I think it would be a very welcome addition, in particular if you are using some library on top of ADO.NET, where it may not be possible for you as a library consumer to modify the command timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions