• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Core.ContentReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EPiServer.Core.ContentReference的典型用法代码示例。如果您正苦于以下问题:C# ContentReference类的具体用法?C# ContentReference怎么用?C# ContentReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContentReference类属于EPiServer.Core命名空间,在下文中一共展示了ContentReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetPageRoute

 public static RouteValueDictionary GetPageRoute(this RequestContext requestContext, ContentReference contentLink)
 {
     var values = new RouteValueDictionary();
     values[RoutingConstants.NodeKey] = contentLink;
     values[RoutingConstants.LanguageKey] = ContentLanguage.PreferredCulture.Name;
     return values;
 }
开发者ID:ojarsb,项目名称:EpiRatingAlloySite,代码行数:7,代码来源:UrlHelpers.cs


示例2: GetOrCreateEventFolder

        public static ContentFolder GetOrCreateEventFolder(ContentReference EventPageBase, string folderName)
        {
            var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
            var contentAssetHelper = ServiceLocator.Current.GetInstance<ContentAssetHelper>();

            ContentFolder folder = null;
            var assetsFolder = contentAssetHelper.GetOrCreateAssetFolder(EventPageBase);

            var folders = contentRepository.GetChildren<ContentFolder>(assetsFolder.ContentLink);

            foreach (ContentFolder cf in folders)
            {
                if (cf.Name == folderName)
                    folder = cf;
            }

            if (folder == null)
            {
                folder = contentRepository.GetDefault<ContentFolder>(assetsFolder.ContentLink);
                folder.Name = folderName;
                contentRepository.Save(folder, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
            }

            return folder;

        }
开发者ID:BVNetwork,项目名称:Attend,代码行数:26,代码来源:Folders.cs


示例3: GetLoginUrl

 private string GetLoginUrl(ContentReference returnToContentLink)
 {
     return string.Format(
         "{0}?ReturnUrl={1}",
         FormsAuthentication.LoginUrl,
         _urlResolver.GetUrl(returnToContentLink));
 }
开发者ID:nimeshjm,项目名称:EPiServer-sample,代码行数:7,代码来源:PageViewContextFactory.cs


示例4: ContentReference

 public void CompareTo_IfTheIdsAreEqualAndTheInstanceWorkIdIsGreaterThanTheObjectParameterWorkId_ShouldReturnMinusOne()
 {
     ContentReference contentReferenceToCompareWith = new ContentReference(_random.Next(0, int.MaxValue), _random.Next(0, int.MaxValue - 1));
     ContentReference contentReference = contentReferenceToCompareWith.Copy();
     contentReference.WorkID = contentReference.WorkID + 1;
     Assert.AreEqual(-1, contentReference.CompareTo(contentReferenceToCompareWith));
 }
开发者ID:HansKindberg-Net,项目名称:HansKindberg-EPiServer-CMS7-Abstractions,代码行数:7,代码来源:ContentReferenceTest.cs


示例5: GetCourseName

 protected string GetCourseName(ContentReference EventPageBase)
 {
     var currentEvent = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>().Get<BVNetwork.Attend.Models.Pages.EventPageBase>(EventPageBase);
     if (currentEvent == null)
         return string.Empty;
     return currentEvent.Name;
 }
开发者ID:BVNetwork,项目名称:Attend,代码行数:7,代码来源:InvoiceList.ascx.cs


示例6: CreateLayoutModel

        public virtual LayoutModel CreateLayoutModel(ContentReference currentContentLink, RequestContext requestContext)
        {
            if (ContentReference.StartPage.ID == 0)
                return null;

            var startPage = _contentLoader.Get<StartPage>(ContentReference.StartPage);

            return new LayoutModel
            {
                // MenuTopPages = startPage.MenuTopPageLinks,
                SearchPageRouteValues = requestContext.GetPageRoute(startPage.SearchPageLink),
                SearchPageLink = startPage.SearchPageLink,

                // header
                SearchLabel = startPage.SearchLabel,
                SearchPlaceholderLabel = startPage.SearchPlaceholderLabel,
                LogoAlternativeText = startPage.LogoAlternativeText,

                // footer
                PhoneNumber = startPage.PhoneNumber,
                PhoneNumberLabel =  startPage.PhoneNumberLabel,
                MailAddress = startPage.MailAddress,
                Address = startPage.Address,
                CvrNumber = startPage.CvrNumber
            };
        }
开发者ID:rbrunge,项目名称:phony-club-denmark,代码行数:26,代码来源:PageViewContextFactory.cs


示例7: GetSessions

 public static List<SessionBlock> GetSessions(ContentReference EventPageBase)
 {
     var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
     List<SessionBlock> sessions = contentRepository.GetChildren<SessionBlock>(GetOrCreateSessionFolder(EventPageBase).ContentLink, new NullLanguageSelector()).ToList<SessionBlock>();
     sessions.Sort(delegate(SessionBlock s1, SessionBlock s2) { return s1.Start.CompareTo(s2.Start); });
     return sessions;
 }
开发者ID:pontushagman,项目名称:Attend,代码行数:7,代码来源:AttendSessionEngine.cs


示例8: ConstructDateContainer

        public IDateContainer ConstructDateContainer(ContentReference parent, string name, DateTime startPublish)
        {
            var dateContainer = this.ConstructDateContainerPage<BlogListPage>(parent, name, startPublish);
            dateContainer.Heading = name;

            return dateContainer;
        }
开发者ID:jeroenslor,项目名称:epi-alloy-demo-kit,代码行数:7,代码来源:BlogItemPage.cs


示例9: CacheKey

 /// <summary>
 /// Instantiates new CacheKey.
 /// </summary>
 /// <param name="type">Singleton page's type.</param>
 /// <param name="parentLink">A root page's content reference under which singleton page gets searched.</param>
 /// <exception cref="ArgumentNullException"></exception>
 public CacheKey(Type type, ContentReference parentLink)
 {
     if (type == null) throw new ArgumentNullException(nameof(type));
     if (parentLink == null) throw new ArgumentNullException(nameof(parentLink));
     Type = type;
     ParentLink = parentLink;
 }
开发者ID:Geta,项目名称:EPi.Extensions,代码行数:13,代码来源:IContentReferenceCache.cs


示例10: Send

        public void Send(ContentReference mailReference, NameValueCollection nameValueCollection, string toEmail, string language)
        {
            var body = GetHtmlBodyForMail(mailReference, nameValueCollection, language);
            var mailPage = _contentLoader.Get<MailBasePage>(mailReference);

            Send(mailPage.MailTitle, body, toEmail);
        }
开发者ID:adrian18hd,项目名称:Quicksilver,代码行数:7,代码来源:MailService.cs


示例11: MenuList

        /// <summary>
        ///     Returns an element for each child page of the rootLink using the itemTemplate.
        /// </summary>
        /// <param name="helper">The html helper in whose context the list should be created</param>
        /// <param name="rootLink">A reference to the root whose children should be listed</param>
        /// <param name="itemTemplate">
        ///     A template for each page which will be used to produce the return value. Can be either a
        ///     delegate or a Razor helper.
        /// </param>
        /// <param name="includeRoot">Whether an element for the root page should be returned</param>
        /// <param name="requireVisibleInMenu">
        ///     Wether pages that do not have the "Display in navigation" checkbox checked should be
        ///     excluded
        /// </param>
        /// <param name="requirePageTemplate">Whether page that do not have a template (i.e. container pages) should be excluded</param>
        /// <remarks>
        ///     Filter by access rights and publication status.
        /// </remarks>
        public static IHtmlString MenuList(this HtmlHelper helper, ContentReference rootLink, Func<MenuItem, HelperResult> itemTemplate = null, 
            bool includeRoot = false, bool requireVisibleInMenu = true, bool requirePageTemplate = true)
        {
            itemTemplate = itemTemplate ?? GetDefaultItemTemplate(helper);
            var currentContentLink = helper.ViewContext.RequestContext.GetContentLink();
            var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();

            Func<IEnumerable<PageData>, IEnumerable<PageData>> filter = pages => pages.FilterForDisplay(requirePageTemplate, requireVisibleInMenu);
            
            var menuItems = contentLoader.GetChildren<PageData>(rootLink)
                .FilterForDisplay(requirePageTemplate, requireVisibleInMenu)
                .Select(x => CreateMenuItem(x, currentContentLink, rootLink, contentLoader, filter))
                .ToList();

            if (includeRoot)
            {
                menuItems.Insert(0, CreateMenuItem(contentLoader.Get<PageData>(rootLink), currentContentLink, rootLink, contentLoader, filter));
            }

            var buffer = new StringBuilder();
            var writer = new StringWriter(buffer);
            foreach (var menuItem in menuItems)
            {
                itemTemplate(menuItem).WriteTo(writer);
            }

            return new MvcHtmlString(buffer.ToString());
        }
开发者ID:dnasir,项目名称:EPi.Extensions,代码行数:46,代码来源:HtmlHelperExtensions.cs


示例12: GetChildrenOrganizer

        private IOrganizeChildren GetChildrenOrganizer(ContentReference pageLink)
        {
            if (ContentReference.IsNullOrEmpty(pageLink))
                return null;

            return GetPage(pageLink) as IOrganizeChildren;
        }
开发者ID:javafun,项目名称:PageStructureBuilder,代码行数:7,代码来源:PageStructureBuilderModule.cs


示例13: CompareTo_IfTheInstanceIdIsLessThanTheObjectParameterId_ShouldReturnMinusOne

 public void CompareTo_IfTheInstanceIdIsLessThanTheObjectParameterId_ShouldReturnMinusOne()
 {
     ContentReference contentReferenceToCompareWith = new ContentReference(_random.Next(1, int.MaxValue));
     ContentReference contentReference = contentReferenceToCompareWith.Copy();
     contentReference.ID = contentReference.ID - 1;
     Assert.AreEqual(-1, contentReference.CompareTo(contentReferenceToCompareWith));
 }
开发者ID:HansKindberg-Net,项目名称:HansKindberg-EPiServer-CMS7-Abstractions,代码行数:7,代码来源:ContentReferenceTest.cs


示例14: CreateLayoutModel

        public virtual LayoutModel CreateLayoutModel(ContentReference currentContentLink, RequestContext requestContext)
        {
            var startPageContentLink = SiteDefinition.Current.StartPage;

            // Use the content link with version information when editing the startpage,
            // otherwise the published version will be used when rendering the props below.
            if (currentContentLink.CompareToIgnoreWorkID(startPageContentLink))
            {
                startPageContentLink = currentContentLink;
            }

            var startPage = _contentLoader.Get<StartPage>(startPageContentLink);

            return new LayoutModel
                {
                    Logotype = startPage.SiteLogotype,
                    LogotypeLinkUrl = new MvcHtmlString(_urlResolver.GetUrl(SiteDefinition.Current.StartPage)),
                    ProductPages = startPage.ProductPageLinks,
                    CompanyInformationPages = startPage.CompanyInformationPageLinks,
                    NewsPages = startPage.NewsPageLinks,
                    CustomerZonePages = startPage.CustomerZonePageLinks,
                    LoggedIn = requestContext.HttpContext.User.Identity.IsAuthenticated,
                    LoginUrl = new MvcHtmlString(GetLoginUrl(currentContentLink)),
                    SearchActionUrl = new MvcHtmlString(EPiServer.Web.Routing.UrlResolver.Current.GetUrl(startPage.SearchPageLink))
                };
        }
开发者ID:tomeo,项目名称:Episerver-Master-Class,代码行数:26,代码来源:PageViewContextFactory.cs


示例15: Get

        public IHttpActionResult Get(int id)
        {
            var reference = new ContentReference(id);
            if (ContentReference.IsNullOrEmpty(reference))
            {
                var message = new HttpResponseMessage();
                message.StatusCode = HttpStatusCode.NotFound;
                message.ReasonPhrase = String.Format("Did not find page content with id {0}", id);
                throw new HttpResponseException(message);
            }

            var pageData = this._contentLoader.Get<PageData>(reference) as MobilePageData;
            if (pageData == null)
            {
                var message = new HttpResponseMessage();
                message.StatusCode = HttpStatusCode.Forbidden;
                message.ReasonPhrase = String.Format("Page with id {0} was not of type {1}", id, typeof(MobilePageData).Name);
                throw new HttpResponseException(message);
            }

            var epiTitle = pageData.Title;
            var epiContent = PreProcess(pageData.Content);

            return Ok(new { title = epiTitle, content = epiContent });
        }
开发者ID:adagetech,项目名称:EPiServer-Cordova-Demo,代码行数:25,代码来源:MobilePageDataController.cs


示例16: GetMenuItems

 public IDictionary<string, QuickNavigatorMenuItem> GetMenuItems(ContentReference currentContent)
 {
     string adminModeUiLink = VirtualPathUtility.Combine(Paths.ProtectedRootPath,
         "CMS/Admin/default.aspx");
     var menuItems = new Dictionary<string, QuickNavigatorMenuItem>();
     menuItems.Add("qn-admin-mode", new QuickNavigatorMenuItem("Admin Mode", adminModeUiLink, null, null, null));
     return menuItems;
 }
开发者ID:episerver,项目名称:Commerce-Demo-Kit,代码行数:8,代码来源:AdminModeQuickNavigator.cs


示例17: ResolveUrl

        public string ResolveUrl(ContentReference contentReference)
        {
            if (ContentReference.IsNullOrEmpty(contentReference))
                return string.Empty;

            var content = _lazyContentRepository.Value.Get<IContent>(contentReference);
            return ResolveUrl(content);
        }
开发者ID:fulgore7,项目名称:JonDJones.com.EPiServerCreativeParallaxTemplae,代码行数:8,代码来源:LinkResolver.cs


示例18: GenerateParticipation

        public static IParticipant GenerateParticipation(ContentReference EventPageBase, string email, bool sendMail, string xform, string logText)
        {
            if (Business.Email.Validation.IsEmail(email))
                return ParticipantProviderManager.Provider.GenerateParticipant(EventPageBase, email, sendMail, xform, logText);
            else
                throw new InvalidEmailException("Attend participant cannot be created without a valid e-mail address.");

        }
开发者ID:BVNetwork,项目名称:Attend,代码行数:8,代码来源:AttendRegistrationEngine.cs


示例19: ResizeImage

        public static UrlBuilder ResizeImage(this HtmlHelper helper, ContentReference image, int? width = null, int? height = null)
        {
            if(image == null || image == ContentReference.EmptyReference)
                throw new ArgumentNullException(nameof(image));

            var url = UrlResolver.Current.GetUrl(image);

            return helper.ResizeImage(url, width, height);
        }
开发者ID:valdisiljuconoks,项目名称:ImageResizer.Plugins.EPiServerBlobReader,代码行数:9,代码来源:HtmlHelperExtensions.cs


示例20: CreateNew

        public ContentReference CreateNew(ContentReference parentNodeLink, Node node, ContentType nodeType)
        {
            //Create a new instance of CatalogContentTypeSample that will be a child to the specified parentNode.
            var nodeContent = _contentRepository.GetDefault<NodeContent>(parentNodeLink, nodeType.ID);

            // Set required properties
            nodeContent.Code = node.code;
            return Update(nodeContent, node, SaveAction.Publish);
        }
开发者ID:episerver,项目名称:Commerce-Demo-Kit,代码行数:9,代码来源:NodeImporter.cs



注:本文中的EPiServer.Core.ContentReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EasyHook.LocalHook类代码示例发布时间:2022-05-24
下一篇:
C# ENTIDADES.bitacorasDTO类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap