【问题标题】:Import content from different CMS into episerver database将不同CMS的内容导入episerver数据库
【发布时间】:2015-05-23 04:01:37
【问题描述】:

我正在将旧版 CMS 迁移到 EPiServer CMS。我想将旧版 CMS 中的内容移动到 EPiServer 的数据库中。有人遇到过这样的场景吗?我在 world.episerver.com 上关注了他们的文档,但不是很清楚。它说在管理部分的配置选项卡下配置 EPiServer 站点以定义内容通道。但他们并没有具体说明要使用哪些 API,以及他们数据库中的不同字段如何映射到 EpiServer 的数据库。任何帮助将不胜感激。

【问题讨论】:

    标签: content-management-system episerver


    【解决方案1】:

    您不应该直接复制到数据库中,因为要正确处理非常困难。 您需要首先在项目中构建内容类型,然后我认为导入内容的最简单方法是构建计划任务或使用导入页面扩展管理界面。 因为您是唯一知道旧 CMS 中的内容应该在 EPiServer 中的内容的人。

    如果您是 EPiServer 的新手,这不是一件容易的事,我认为这可能是联系专家服务的最快方式,然后他们会帮助您最终指导您。

    祝你好运!

    【讨论】:

      【解决方案2】:

      您可以使用 EpiServer 的 IContenntRepository 和 IContentTypeRepositoiry 以编程方式添加页面,如下所示:

      using EPiServer.Core;
      using EPiServer.DataAbstraction;
      using EPiServer.DataAnnotations;
      using EPiServer.ServiceLocation;
      
      PageReference parent = PageReference.RootPage;
      
      IContentRepository contentRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();
      IContentTypeRepository contentTypeRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentTypeRepository>();
      
      PageData myPage = contentRepository.GetDefault<PageData>(parent, contentTypeRepository.Load("StandardPage").ID);
      
      StandardPage standardPage = contentRepository.GetDefault<StandardPage>(parent);
      
      myPage.Property["PageName"].Value = "Name";
      myPage.Property["MainBody"].Value = "My Page";
      myPage.Property["PageTypeName"].Value = "Standard Page";
      myPage.Property["PagePendingPublish"].Value = true;
      
      myPage.URLSegment = EPiServer.Web.UrlSegment.CreateUrlSegment(myPage);                    
      
      contentRepository.Save(myPage, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-06-30
        • 1970-01-01
        相关资源
        最近更新 更多