/// <summary> /// Gets the <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> with the specified template id /// </summary> /// <param name="componentUri">Component uri</param> /// <param name="templateId">Component template id as <see cref="T:System.Int32" /></param> /// <returns> /// <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> /// </returns> public Contracts.ComponentPresentation ComponentPresentation(String componentUri, int templateId) { Logger.Debug("ComponentPresentation: componentUri \"{0}\", templateId \"{1}\".", componentUri, templateId); return(Cache.Get <Contracts.ComponentPresentation>( String.Format("ComponentPresentation-{0}-{1}", componentUri, templateId), () => { using (ComponentPresentation componentPresentation = ContentDelivery.DynamicContent.ComponentPresentationCache.GetComponentPresentation(componentUri, templateId)) { return componentPresentation.ToContract(); } }, CacheRegion.ItemMeta | CacheRegion.ComponentPresentation | CacheRegion.ComponentPresentationMeta, componentUri)); }
/// <summary> /// Gets the <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> with the specified templateUri /// </summary> /// <param name="publicationId">Publication id as <see cref="T:System.Int32" /></param> /// <param name="componentId">Component id as <see cref="T:System.Int32" /></param> /// <param name="templateId">Component template id as <see cref="T:System.Int32" /></param> /// <returns> /// <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> or null /// </returns> public Contracts.ComponentPresentation ComponentPresentation(int publicationId, int componentId, int templateId) { Logger.Debug("ComponentPresentation: publicationId \"{0}\", componentId \"{1}\", templateId \"{2}\".", publicationId, componentId, templateId); return(Cache.Get <Contracts.ComponentPresentation>( String.Format("ComponentPresentation-{0}-{1}-{2}", publicationId, componentId, templateId), () => { using (ComponentPresentation componentPresentation = ContentDelivery.DynamicContent.ComponentPresentationCache.GetComponentPresentation(publicationId, componentId, templateId)) { return componentPresentation.ToContract(); } }, CacheRegion.ItemMeta | CacheRegion.ComponentPresentation | CacheRegion.ComponentPresentationMeta, new TcmUri(publicationId, componentId))); }
/// <summary> /// Gets the <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> with highest priority. /// </summary> /// <param name="componentUri">Component uri</param> /// <returns> /// <see cref="T:TcmCDService.Contracts.ComponentPresentation" /> /// </returns> public Contracts.ComponentPresentation ComponentPresentationWithHighestPriority(String componentUri) { Logger.Debug("ComponentPresentationWithHighestPriority: componentUri \"{0}\".", componentUri); return(Cache.Get <Contracts.ComponentPresentation>( String.Format("ComponentPresentationWithHighestPriority-{0}", componentUri), () => { using (ComponentPresentation componentPresentation = ContentDelivery.DynamicContent.ComponentPresentationCache.GetComponentPresentationWithHighestPriority(componentUri)) { return componentPresentation.ToContract(); } }, CacheRegion.ItemMeta | CacheRegion.ComponentPresentation | CacheRegion.ComponentPresentationMeta, componentUri)); }