将来自不同CMS的内容导入episerver数据库

时间:2015-05-23 04:01:37

标签: content-management-system episerver

我正在努力将旧版CMS迁移到EPiServer CMS上。我想将内容从旧CMS移到EPiServer的数据库中。有人碰到这样的场景吗?我在world.episerver.com上关注他们的文件,但不是很清楚。它说要在Admin部分的config选项卡下配置EPiServer站点来定义Content Channel。但是他们并没有谈到究竟使用什么API以及不同的字段如何在他们的数据库中映射到EpiServer的数据库。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:2)

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

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

祝你好运!!

答案 1 :(得分:1)

您可以使用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);