Hi,
Working with the adapter scenario (1.0.2005.1, generating C# for .NET 1.1), I've got one stored procedure that takes a long time (~ 2 minutes) to return a set of results. By using the RetrievalProcedures class, though, I can't change the CommandTimeOut property of the DataAccessAdapter, because the adapter is created in the generated code.
I can copy the necessary code out of RetrievalProcedures and put it in a separate class:
DataTable dt = new DataTable("GetPagedFilteredRows");
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
SqlParameter[] parameters = new SqlParameter[5];
parameters[0] = new SqlParameter("@DataAnalysisTableID", SqlDbType.Int, 0, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Current, dataAnalysisTableId);
// ... (more parameters here)
// This proc may take a while: set a higher timeout than normal
adapter.CommandTimeOut = 180;
bool hasSucceeded = adapter.CallRetrievalStoredProcedure("prcGetPagedFilteredRows", parameters, dt);
}
But now I have a chunk of database-specific, non-generated code to maintain. If I change the procedure at some point in the future, I have to remember to come back to this class and update the code manually.
Is there a better way of changing the Timeout for some (but not all) stored procedures?
-Martin.