Print Page | Close Window

How can I set the default timeout, so as to apply to all RdbQuery's?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=171
Printed Date: 07-Nov-2025 at 9:05am


Topic: How can I set the default timeout, so as to apply to all RdbQuery's?
Posted By: Customer
Subject: How can I set the default timeout, so as to apply to all RdbQuery's?
Date Posted: 12-Jul-2007 at 1:10pm
From DevForce help on the CommandTimout property fo the EntityQuery class:
 
>A value of 0 indicates that the default timeout should be used.
 
How can I set the default timeout, so as to apply to all RdbQuery's?



Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 1:11pm
I have looked into your question and found out that there is a default timeout value for the DbCommand class that the providers that we use (e. g. OleDb, SqlClient, etc.) inherit from.  This value is 30 seconds.  From what you said I inferred that you would like to be able to set a timeout value that would apply to all RdbQueries/EntityQueries.  Am I correct in what I am thinking?  If so, I am told there is currently no way to do this.  If you would like I can submit a feature enhancment request for this.  Please let me know if I am correct in what I am thinking and that this is what you would like.


Posted By: Customer
Date Posted: 12-Jul-2007 at 1:12pm
Yes, this is what I am asking, if there is a way to set a timeout value that would apply to all RdbQueries/EntityQueries.


Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 1:13pm
Our chief architect suggested that a CommandTimeout value could be globally set by listening for the PersistenceManager Fetching event.  Sample code declaring the event delegate, listening for it, and setting the query Timeout value within the event handler follows:
 
     PersistenceManager mPm = PersistenceManager.DefaultManager;
      mPm.Fetching += new System.EventHandler<EntityFetchingEventArgs>(mPm_Fetching);
   .
   .
   .

   private static void mPm_Fetching(object sender, EntityFetchingEventArgs e) {
      if (e.Query.GetType() == typeof(EntityQuery)) {
        e.Query.CommandTimeout = 1;
      }
     }
 
Hope this helps.



Print Page | Close Window