Normal
Will just reply one more thing to myself tonight.Looked in the Gentle.NET Framework and in PersistenceBroker I find the below code indicating unless either "con" or "tr" is passed to Retrieve it will create a new connection to the database engine for each retrieve. If that could be avoided I'm sure the perfomance would be improved - maybe for all database engines. But it could be that MSSQL is using client side connection pooling and has no need to run those initial queries?Just need to find the place in TvServer code where this is called. Or is this something explicitly handled by the FrameWork?/// <summary>/// Retrieve data for the specified type. Throws an exception for unsupported types./// </summary>/// <param name="type">The type of object</param>/// <param name="key">The key indentifying the object</param>/// <param name="conn">An existing database connection to reuse. This is useful/// when you need to execute statements in the same session as a previous statement.</param>/// <param name="tr">The database transaction for when participating in transactions.</param>/// <returns>An SqlResult containing the returned rows and helper methods</returns>public SqlResult Retrieve( Type type, Key key, IDbConnection conn, IDbTransaction tr ){ SqlStatement stmt = GetRetrieveStatement( type, key ); // connections are supplied from outside when in a transaction or executing batch queries conn = tr != null ? tr.Connection : ( conn != null ? conn : stmt.SessionBroker.Provider.GetConnection() ); SqlResult sr = stmt.Execute( conn, tr ); // require that operation succeeded and a valid result if( IsPrimaryKeyForType( type, key ) ) { Check.Verify( sr.ErrorCode == 0, Error.NoSuchRecord, type, key, sr.Error ); Check.Verify( sr.RowsContained == 1, Error.UnexpectedRowCount, sr.RowsContained, 1 ); } return sr;}
Will just reply one more thing to myself tonight.
Looked in the Gentle.NET Framework and in PersistenceBroker I find the below code indicating unless either "con" or "tr" is passed to Retrieve it will create a new connection to the database engine for each retrieve. If that could be avoided I'm sure the perfomance would be improved - maybe for all database engines. But it could be that MSSQL is using client side connection pooling and has no need to run those initial queries?
Just need to find the place in TvServer code where this is called. Or is this something explicitly handled by the FrameWork?
/// <summary>
/// Retrieve data for the specified type. Throws an exception for unsupported types.
/// </summary>
/// <param name="type">The type of object</param>
/// <param name="key">The key indentifying the object</param>
/// <param name="conn">An existing database connection to reuse. This is useful
/// when you need to execute statements in the same session as a previous statement.</param>
/// <param name="tr">The database transaction for when participating in transactions.</param>
/// <returns>An SqlResult containing the returned rows and helper methods</returns>
public SqlResult Retrieve( Type type, Key key, IDbConnection conn, IDbTransaction tr )
{
SqlStatement stmt = GetRetrieveStatement( type, key );
// connections are supplied from outside when in a transaction or executing batch queries
conn = tr != null ? tr.Connection : ( conn != null ? conn : stmt.SessionBroker.Provider.GetConnection() );
SqlResult sr = stmt.Execute( conn, tr );
// require that operation succeeded and a valid result
if( IsPrimaryKeyForType( type, key ) )
Check.Verify( sr.ErrorCode == 0, Error.NoSuchRecord, type, key, sr.Error );
Check.Verify( sr.RowsContained == 1, Error.UnexpectedRowCount, sr.RowsContained, 1 );
}
return sr;