We just migrated from 5.1 to 5.8 and are experiencing some issues with the command timeout not being used correctly.
Snippet of 5.1:
// SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore
using System.Data;
using System.Data.Common;
/// <summary>
/// Creates the stored procedure call command for the stored proc specified.
/// </summary>
/// <param name="storedProcedureToCall">The stored procedure to call.</param>
/// <param name="parameters">array of parameters to pass</param>
/// <returns>ready to use DbCommand</returns>
protected virtual DbCommand CreateStoredProcedureCallCommand(string storedProcedureToCall, DbParameter[] parameters)
{
DbCommand command = GetDbProviderFactoryInstance().CreateCommand();
string procName = command.CommandText = CreateCorrectStoredProcedureName(storedProcedureToCall);
command.Connection = GetActiveConnection();
if (IsTransactionInProgress)
{
command.Transaction = PhysicalTransaction;
}
command.CommandType = CommandType.StoredProcedure;
if (CommandTimeOut > 0)
{
command.CommandTimeout = CommandTimeOut;
}
command.Parameters.AddRange(parameters);
return command;
}
So the command timeout is set based on the property of the DataAccessAdapterCore.CommandTimeOut.
In 5.8 the creation of the command is delegated to the QueryCreationManager:
// SD.LLBLGen.Pro.ORMSupportClasses.Adapter.QueryCreationManager
using System.Data;
using System.Data.Common;
/// <summary>
/// Creates the stored procedure call command for the stored proc specified.
/// </summary>
/// <param name="storedProcedureToCall">The stored procedure to call.</param>
/// <param name="parameters">array of parameters to pass</param>
/// <returns>ready to use DbCommand</returns>
protected internal virtual DbCommand CreateStoredProcedureCallCommand(string storedProcedureToCall, DbParameter[] parameters)
{
DbCommand command = _containingAdapter.GetDbProviderFactoryInstance().CreateCommand();
if (command == null)
{
return null;
}
string procName = command.CommandText = CreateCorrectStoredProcedureName(storedProcedureToCall);
command.Connection = _containingAdapter.GetActiveConnection();
if (_containingAdapter.IsTransactionInProgress)
{
command.Transaction = _containingAdapter.PhysicalTransaction;
}
command.CommandType = CommandType.StoredProcedure;
if (CommandTimeOut > 0)
{
command.CommandTimeout = CommandTimeOut;
}
command.Parameters.AddRange(parameters);
return command;
}
The QueryCreationManager assigns its own CommandTimeOut to the command but that CommandTimeOut is only set once in the constructor of the QueryCreationManager and not related to the command timout as managed on the "_containingAdapter".
Should QueryCreationManager not simply use the _containingAdapter.CommandTimeOut instead of using (and having) its own member?
Best, Dick