當前位置: 首頁>>代碼示例>>C#>>正文


C# PageData.CreateWritableClone方法代碼示例

本文整理匯總了C#中System.PageData.CreateWritableClone方法的典型用法代碼示例。如果您正苦於以下問題:C# PageData.CreateWritableClone方法的具體用法?C# PageData.CreateWritableClone怎麽用?C# PageData.CreateWritableClone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.PageData的用法示例。


在下文中一共展示了PageData.CreateWritableClone方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ClonePage

        /// <summary>
        /// Clones a page to make it appear to come from where the content provider is attached
        /// </summary>
        private PageData ClonePage(PageData originalPage)
        {
            if (originalPage == null)
            {
                throw new ArgumentNullException("originalPage", "No page to clone specified");
            }

            _logger.DebugFormat("Cloning page {0}...", originalPage.PageLink);

            var clone = originalPage.CreateWritableClone();

            // If original page was under the clone root, we make it appear to be under the entry root instead
            if (originalPage.ParentLink.CompareToIgnoreWorkID(CloneRoot))
            {
                clone.ParentLink = EntryRoot;
            }

            // All pages but the entry root should appear to come from this content provider
            if (!clone.PageLink.CompareToIgnoreWorkID(EntryRoot))
            {
                clone.ContentLink.ProviderName = ProviderKey;
            }

            // Unless the parent is the entry root, it should appear to come from this content provider
            if (!clone.ParentLink.CompareToIgnoreWorkID(EntryRoot))
            {
                var parentLinkClone = clone.ParentLink.CreateWritableClone();

                parentLinkClone.ProviderName = ProviderKey;

                clone.ParentLink = parentLinkClone;
            }

            // This is integral to map the cloned page to this content provider
            clone.LinkURL = ConstructContentUri(originalPage.PageTypeID, clone.ContentLink, clone.ContentGuid).ToString();

            return clone;
        }
開發者ID:kmorcinek,項目名稱:EPiServer7-alloy-template-web-forms,代碼行數:41,代碼來源:ClonedContentProvider.cs


注:本文中的System.PageData.CreateWritableClone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。