ASPX templates
Version 5.x > ASPX templates > Retrieving current document fields efficiently. View modes: 
User avatar
Member
Member
libertybay - 7/25/2011 3:59:57 PM
   
Retrieving current document fields efficiently.
What's the recommended method of retrieving custom data fields from the current document in order to minimize database calls? - CMSContext.CurrentDocument.GetValue() for each field, or use one of DocumentHelper.GetDocument(), TreeHelper.SelectSingleNode()?, or another way? If the latter, does it make sense to wrap the call in DataCacheHelper.GetCached<CMS.TreeEngine.TreeNode>?

Thanks!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/26/2011 12:51:06 AM
   
RE:Retrieving current document fields efficiently.
Hi,

if you use CMSContext.CurrentDocument.GetValue("columnName"), the context data are selected from the cache therefore this way is effective.

DocumentHelper.GetDocument(), TreeHelper.SelectSingleNode() would select data from database.

Best regards,
Ivana Tomanickova