Using DataCacheHelper.GetCached9 with TreeHelper.SelectNodes

Stefan Lorenz asked on February 18, 2014 09:40

Hi,

In my code behind, I retrieve Documents using the following code:

DataSet documents = 
tree.SelectNodes(CMSContext.CurrentSiteName,
                             Path,
                             CMSContext.PreferredCultureCode,
                             true,
                            "CMS.News", 
                            null, 
                           OrderBy,
                           MaxRelativeLevel,
                           SelectOnlyPublished);

That works like a charm. However, I'd like to try to get the data from cache, but I get the syntax error "cannot convert from 'method group' to CMS.DataEngine.DataCacheHelper.GetEventHandler9<...>(...)" on the "handler" parameter of GetCached9(): DataSet documents =
DataCacheHelper.GetCached9<DataSet, string, string, string, bool, string, string, string, int, bool> (
CMSContext.CurrentSiteName,
Path,
CMSContext.PreferredCultureCode, true,
"CMS.News",
null,
OrderBy,
MaxRelativeLevel,
SelectOnlyPublished,
TreeHelper.SelectNodes, <- THIS GIVES THE SYNTAX ERROR
"myKey",
5,
false, null, null);

I tried the example using 3 parameters from here and that works, but I dont have a clue what's wrong with my code.

Anyone got an idea?

Best regards Stefan

Recent Answers


Stefan Lorenz answered on February 19, 2014 03:39

Nevermind, found the error: Of course I need to provide my initialized TreeProvider instance.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.