I am using Nettiers v2.2. I would like to make use of the Microsoft Enterprise Library caching mechanism. From my understanding and research, Nettiers implements a custom cache manager under Entities.Entitymanager. I have set the EnableEntityTracking = "On" and after some debugging,
I have relealized the following - that even if the cache is enabled the datalayer still queries the database via the ExecuteReader function.
Functions withing the Fill method then check whether the objects is cacheable or not and reads from cache to populate the rows into a TLIST<>.
I believe this goes against the use of the cache as the underlying database is still being queried. My goal is to improve performance by caching
the rows from one of the base /static tables.
Any insights would be appreciated.
Thanks
public override DataLib.Entities.TList<Country> GetAll(TransactionManager transactionManager, int start, int pageLength, out int count)
{
SqlDatabase database = new SqlDatabase(this._connectionString);
DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.usp_tb_country_Get_List", _useStoredProcedure);
IDataReader reader = null;
//Create Collection
DataLib.Entities.TList<Country> rows = new DataLib.Entities.TList<Country>();
try
{
//Provider Data Requesting Command Event
OnDataRequesting(new CommandEventArgs(commandWrapper, "GetAll", rows));
if (transactionManager != null)
{
reader = Utility.ExecuteReader(transactionManager, commandWrapper);
}
else
{
reader = Utility.ExecuteReader(database, commandWrapper);
}
Fill(reader, rows, start, pageLength);
count = -1;
if(reader.NextResult())
{
if(reader.Read())
{
count = reader.GetInt32(0);
}
}
//Provider Data Requested Command Event
OnDataRequested(new CommandEventArgs(commandWrapper, "GetAll", rows));
}
finally
{
if (reader != null)
reader.Close();
commandWrapper = null;
}
return rows;
}//end getall
#endregion