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.

  1. Create the pipe definitions
    You create default pipe definitions from the built-in Content pipe. You can also create custom pipe definitions.

  2. Register the pipe definitions
    After you create the pipe definitions, you must register them.

  3. Modify the pipe definitions
    You can modify the definitions of a built-in pipe or custom pipe.
    To modify the pipe definitions you use the GetPipeDefinitions method.

    The method GetPipeDefinitions accepts 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:

C#
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);
       }

   }
}
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?