/// <summary> /// Retrieves the <see cref="T:TcmCDService.Contracts.ComponentMeta" /> for a given component id /// </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> /// <returns> /// <see cref="T:TcmCDService.Contracts.ComponentMeta" /> or null /// </returns> public Contracts.ComponentMeta ComponentMeta(int publicationId, int componentId) { Logger.Debug("ComponentMeta: publicationId \"{0}\", componentId \"{1}\".", publicationId, componentId); return(Cache.Get <Contracts.ComponentMeta>( String.Format("ComponentMeta-{0}-{1}", publicationId, componentId), () => { using (IComponentMeta componentMeta = ContentDelivery.Meta.ComponentMetaCache.GetComponentMeta(publicationId, componentId)) { return componentMeta.ToContract(); } }, CacheRegion.ItemMeta | CacheRegion.ComponentMeta | CacheRegion.ComponentPresentationMeta, new TcmUri(publicationId, componentId))); }
/// <summary> /// Retrieves the <see cref="T:TcmCDService.Contracts.ComponentMeta" /> for a given component Uri /// </summary> /// <param name="componentUri">Component uri</param> /// <returns> /// <see cref="T:TcmCDService.Contracts.ComponentMeta" /> /// </returns> public Contracts.ComponentMeta ComponentMeta(String componentUri) { Logger.Debug("ComponentMeta: componentUri \"{0}\".", componentUri); return(Cache.Get <Contracts.ComponentMeta>( String.Format("ComponentMeta-{0}", componentUri), () => { using (IComponentMeta componentMeta = ContentDelivery.Meta.ComponentMetaCache.GetComponentMeta(componentUri)) { return componentMeta.ToContract(); } }, CacheRegion.ItemMeta | CacheRegion.ComponentMeta | CacheRegion.ComponentPresentationMeta, componentUri)); }