SQLCacheDependency Problem

Posts   
 
    
krkc
User
Posts: 20
Joined: 12-Apr-2006
# Posted on: 15-Jun-2006 13:08:02   

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

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 15-Jun-2006 22:54:06   

This is just a guess, but when using paging I would think that you may need to also override PerformGetMultiAsDataTableAction which accepts paging parameters.

krkc
User
Posts: 20
Joined: 12-Apr-2006
# Posted on: 16-Jun-2006 07:46:51   

bclubb wrote:

This is just a guess, but when using paging I would think that you may need to also override PerformGetMultiAsDataTableAction which accepts paging parameters.

Yeah.. you are correct. When paging is done, the **PerformGetMultiAsDataTableAction **method is not called. But to access the SQLCacheDependency to work properly I've used that.