예제 #1
0
        /// <summary>
        /// Creates a new Link instance and returnes this as a string
        /// </summary>
        /// <param name="title">Attribute to include in the link as string</param>
        /// //example<a href="..">title</a>
        /// <param name="tcmuri">tcmUri of the Component as string</param>
        /// <returns>url string</returns>
        public static string ComponentLinkMethod(string tcmuri)
        {
            MI4TLogger.WriteLog(ELogLevel.INFO, "Entering method TridionDataHelper.ComponentLinkMethod");
            ComponentLink componentLink = null;
            Link          link          = null;
            int           publicationID;
            String        linkUrl = string.Empty;

            try
            {
                publicationID = TridionDataHelper.GetContentRepositoryId(tcmuri);
                MI4TLogger.WriteLog(ELogLevel.DEBUG, "Publication ID: " + publicationID);
                componentLink = new ComponentLink(publicationID);
                link          = componentLink.GetLink(tcmuri);
                MI4TLogger.WriteLog(ELogLevel.DEBUG, "ComponentLink: " + link);
                if (link.IsResolved)
                {
                    linkUrl = link.Url;
                }
                MI4TLogger.WriteLog(ELogLevel.INFO, "Link URL : " + linkUrl);
            }
            catch (Exception ex)
            {
                MI4TLogger.WriteLog(ELogLevel.ERROR, ex.Message + ex.StackTrace);
            }
            finally
            {
                componentLink.Dispose();
                componentLink = null;
                link          = null;
            }

            MI4TLogger.WriteLog(ELogLevel.INFO, "Exiting method TridionDataHelper.ComponentLinkMethod");
            return(linkUrl);
        }
예제 #2
0
 protected virtual void Dispose(bool isDisposed)
 {
     if (!isDisposed)
     {
         if (componentLink != null)
         {
             componentLink.Dispose();
             componentLink = null;
         }
     }
 }
 protected virtual void Dispose(bool isDisposed)
 {
     if (isDisposed)
     {
         return;
     }
     if (_componentLink != null)
     {
         _componentLink.Dispose();
         _componentLink = null;
     }
     foreach (ComponentLink cl in _componentLinks.Values)
     {
         cl?.Dispose();
     }
     _componentLinks.Clear();
 }
 protected virtual void Dispose(bool isDisposed)
 {
     if (!isDisposed)
     {
         if (componentLink != null)
         {
             componentLink.Dispose();
             componentLink = null;
         }
         foreach (ComponentLink cl in _componentLinks.Values)
         {
             if (cl != null)
             {
                 cl.Dispose();
             }
         }
         _componentLinks.Clear();
     }
 }