Setting Command Timeout globally in Asp.Net / windows applications...

T

tom.herz

Hi,

I've been tasked with the following:

We need to add elements to app.config and web.config to be able to
specify the CommandTimeout for SQL Commands. Since there is no option
in the connection string to set this property globally, this means
that every time we execute an SQL command we will need to set the
CommandTimeout property on the object.

It might be worth looking at implementing a ServiceRegistry to replace
the current multiple places where we allocate connections.


Any help on this issue would be greatly appreciated.
 
M

Miha Markic [MVP C#]

Can't you create a global method that returns properly initialized command?
 
T

tom.herz

Can't you create a global method that returns properly initialized command?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & developmentwww.rthand.com
Blog:http://cs.rthand.com/blogs/blog_with_righthand/




I've been tasked with the following:
We need to add elements to app.config and web.config to be able to
specify the CommandTimeout for SQL Commands. Since there is no option
in the connection string to set this property globally, this means
that every time we execute an SQL command we will need to set the
CommandTimeout property on the object.
It might be worth looking at implementing a ServiceRegistry to replace
the current multiple places where we allocate connections.
Any help on this issue would be greatly appreciated.- Hide quoted text -

- Show quoted text -

Hi,

That would be the ticket, but I don't know how to do it. Can you
please supply a bit of sample code? It would be MUCH appreciated.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top