自定义零件属性出口果园1.6失踪 [英] Custom part properties missing in export Orchard 1.6

查看:174
本文介绍了自定义零件属性出口果园1.6失踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在果园1.6导入导出模块方面的问题:结果
我想自定义类型出口与中有一个属性的一部分。导出XML包含TitlePart,CommonPart,BodyPart类和AutoroutePart数据,但该数据从我个人而言是不存在的。

I have a problem with the import export module in Orchard 1.6:
I want to export a custom type with a part that has a property in it. The export XML contains data from TitlePart, CommonPart, BodyPart and AutoroutePart, however the data from my own part is not there.

有什么我应该做的像实现一个接口或使其包含在导出XML中压倒一切的我的一部分东西吗?有什么(如果有的话)的出口模块的扩展点?我有模块的源代码,但不能找到它。

Is there anything I should do like implementing an interface or overriding something on my part so that it is contained within the export XML? What are (if any) the extension points of the export module? I have the source of the module but cannot find it.

特定的输出模块的module.txt是:结果
名称:进出口结果
路径:ImportExport结果
防伪:启用结果
作者:果园团队结果
网站: http://orchardpro​​ject.net 结果
版本:1.6结果
OrchardVersion:1.4结果
说明:提供内容项的数据导入和导出功能结果。
FeatureDescription:进口和出口的内容项数据结果
类别:内容

The module.txt of the particular export module is:
Name: Import Export
Path: ImportExport
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.6
OrchardVersion: 1.4
Description: Provides content item data import and export capability.
FeatureDescription: Imports and exports content item data
Category: Content

在此先感谢:)

推荐答案

您需要重写theExporting /导入方法,您的内容部分的驱动程序。下面是一个简单的例子 Orchard.Core.Title.Driver.TitlePartDriver

You need to override theExporting/Importing methods in your content part driver. Here is a simple example from the Orchard.Core.Title.Driver.TitlePartDriver:

protected override void Importing(TitlePart part, ImportContentContext context) {
    var title = context.Attribute(part.PartDefinition.Name, "Title");
    if (title != null) {
        part.Title = title;
    }
}

protected override void Exporting(TitlePart part, ExportContentContext context) {
    context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title);
}

ImportExportContext 类,可以访问用来生成输出文档的基本XML结构,所以如果你习惯使用System.Xml.Linq的,的XDocument等则将一切似乎熟悉。

The ImportExportContext class provides access to the underlying XML structure used to generate the output document, so if you are used to using System.Xml.Linq, XDocument etc then it will all seem familiar.

有使用情况在其他一些例子 Orchard.Core.Common.Drivers.CommonPartDriver Orchard.Users.Drivers.UserPartDriver Orchard.Comments.Drivers.CommentPartDriver

There are some other examples of usage in Orchard.Core.Common.Drivers.CommonPartDriver, Orchard.Users.Drivers.UserPartDriver, and Orchard.Comments.Drivers.CommentPartDriver.

这篇关于自定义零件属性出口果园1.6失踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆