Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Georgy-Losenkov opened this issue Jun 18, 2020 · 9 comments · Fixed by #722
Closed

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

Georgy-Losenkov opened this issue Jun 18, 2020 · 9 comments · Fixed by #722
Labels
💡 Enhancement New feature request

Comments

@Georgy-Losenkov
Copy link

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.

@cheenamalhotra
Copy link
Member

Hi @Georgy-Losenkov

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

@cheenamalhotra cheenamalhotra added the 💡 Enhancement New feature request label Jun 18, 2020
@cheenamalhotra cheenamalhotra added this to Needs triage in SqlClient Triage Board via automation Jun 18, 2020
@cheenamalhotra cheenamalhotra moved this from Needs triage to Ideas for Future in SqlClient Triage Board Jun 18, 2020
@roji
Copy link
Member

roji commented Jun 19, 2020

For reference, Npgsql has this.

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 30, 2020

Would you consider a community PR for this?

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 30, 2020

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

@roji
Copy link
Member

roji commented Aug 30, 2020

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).

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 30, 2020

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

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 31, 2020

API proposal:

SqlConnectionStringBuilder: public int CommandTimeout { get; set; }

SqlConnection: public int CommandTimeout { get; }

SqlCommand will use same precedence logic as here

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Aug 31, 2020

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.

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 31, 2020

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
Labels
💡 Enhancement New feature request
Projects
Development

Successfully merging a pull request may close this issue.

4 participants