I am using a grid to display the data on my webpage, and I have 3 projects in my solution (UI, BLL, DAL). When I load the webpage I am creating the instance of a class written n my BLL project to populate the data, and in BLL I'm creating the object for the class in DAL and returning the datatable.
I've used the Dependency like this.
class StudyColl : StudyCollection
{
public StudyColl()
{
}
protected override IDao CreateDAOInstance()
{
StudyDAO studyDao = new StudyDAO();
return studyDao;
}
class StudyDAL : StudyDAO
{
SqlCacheDependency dependency;
public StudyDAL()
{
}
public override void ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, ITransaction containingTransaction, IEntityCollection collectionToFill, bool allowDuplicates, SD.LLBLGen.Pro.ORMSupportClasses.IValidator validatorToUse, IEntityFields fieldsUsedForQuery)
{
SqlDependency.Start(queryToExecute.Connection.ConnectionString);
dependency = new SqlCacheDependency((SqlCommand)queryToExecute.Command);
base.ExecuteMultiRowRetrievalQuery(queryToExecute, containingTransaction, collectionToFill, allowDuplicates, validatorToUse, fieldsUsedForQuery);
}
}
}
Now when I refresh the page using F5, the SQLDependency is working fine. But, when I use the Paging or Sorting option's on my grid I see in SQL Profiler that the query is posted back to the SQLServer to get the data.
If this is the senario then how can I make use of the cache object in .NET 2.0.
Please advice,
Ravi