Register pipe mappings
The pipe mappings define how data is transformed when moving through the pipe. The mappings are part of PipeSettings.
-
Create the pipe mappings.
You create default pipe mappings from the built-inContentpipe. You can also create custom mappings.
You use the translator to combine multiple properties into a single. -
Register the pipe mappings.
After you create the pipe mappings, you must register them.
One pipe can be used for both purposes - to pass data to a publishing point or to take data from a publishing point. The both cases may require different mappings. TheRegisterPipeMappingsmethodaccepts an extra parameter that specifies whether the pipe is inbound or outbound. -
Modify the pipe mappings
You can modify the mappings of a build-in pipe or custom pipe.
To modify the pipe mappings you use theGetPipeMappingsmethod.The method
GetPipeMappingsaccepts the name and whether inbound or outbound is the pipe as parameters. The method returns a copy of the registered mappings. After your modifications, you must register them again to apply the changes.
Use the following code sample:
using System.Collections.Generic;
using Telerik.Sitefinity.Publishing;
using Telerik.Sitefinity.Publishing.Model;
using Telerik.Sitefinity.Publishing.Pipes;
namespace SitefinityWebApp
{
public class RegisterPipeMappings
{
/// <summary>
/// Registers pipe mappings
/// The pipe mappings define how data is transformed when moving through the pipe. The mappings are part of PipeSettings.
/// </summary>
public static void RegisterThePipeMappings()
{
// To create default pipe mappings from the build-in pipes, use GetDefaultMappings implemented in all pipes
List<Mapping> mappingsList = ContentInboundPipe.GetDefaultMappings();
// We can also create custom pipe mappings
List<Mapping> customMappingsList = RegisterPipeTemplates.CreateCustomMappings();
// After we create the pipe mappings, we should register them
PublishingSystemFactory.RegisterPipeMappings("MyCustomPipeName", true, mappingsList);
// We can modify the mappings of a build-in pipe or custom pipe. To get the pipe mappings for already registered pipe, use the GetPipeMappings method.
// The method returns a copy of the registered mappings.
var registeredMappings = PublishingSystemFactory.GetPipeMappings(ContentInboundPipe.PipeName, true);
// After the modifications, we must register them again to apply the changes
PublishingSystemFactory.RegisterPipeMappings(ContentInboundPipe.PipeName, true, registeredMappings);
}
}
}