Register pipe definitions
The pipe definitions are a collection of items describing the type members used by the mappings. They are used in the UI for changing the default mappings.
-
Create the pipe definitions
You create default pipe definitions from the built-inContentpipe. You can also create custom pipe definitions. -
Register the pipe definitions
After you create the pipe definitions, you must register them. -
Modify the pipe definitions
You can modify the definitions of a built-in pipe or custom pipe.
To modify the pipe definitions you use theGetPipeDefinitionsmethod.The method
GetPipeDefinitionsaccepts the name of the pipe as a parameter. It returns a copy of the registered definitions. After your modifications, you must register them again to apply the changes.
Use the following code sample:
using System.Collections.Generic;
using Telerik.Sitefinity.Localization;
using Telerik.Sitefinity.Publishing;
using Telerik.Sitefinity.Publishing.Model;
using Telerik.Sitefinity.Publishing.Pipes;
namespace SitefinityWebApp
{
public class RegisterThePipeDefinitions
{
/// <summary>
/// Registers pipe definitions
/// The pipe definitions are a collection of items describing the type members used by the mappings. They are used in the UI for changing the default mappings.
/// </summary>
public static void RegisterPipeDefinitions()
{
// To create default pipe definitions from the build-in pipes, use the PublishingSystemFactory.CreateDefaultContentPipeDefinitions method
IList<IDefinitionField> buildInDefinitions = PublishingSystemFactory.CreateDefaultContentPipeDefinitions();
// We can also create custom definitions
IDefinitionField[] customDefinitions = new IDefinitionField[]
{
new SimpleDefinitionField(PublishingConstants.FieldContent, Res.Get<PublishingMessages>().RssContent),
new SimpleDefinitionField(PublishingConstants.FieldLink, Res.Get<PublishingMessages>().RssLink)
};
// After we create the pipe definitions, we should register them.
PublishingSystemFactory.RegisterPipeDefinitions("MyCustomPipeName", customDefinitions);
// We can modify the definitions of a build-in pipe or custom pipe. To get the pipe definitions use the GetPipeDefinitions method. It returns a copy of the registered definitions.
var registeredDefinitions = PublishingSystemFactory.GetPipeDefinitions(ContentInboundPipe.PipeName);
// After the modifications, we must register them again to apply the changes
PublishingSystemFactory.RegisterPipeDefinitions(ContentInboundPipe.PipeName, registeredDefinitions);
}
}
}