---
title: "パイプラインステップコンバータの実装"
slug: "implement-a-pipeline-step-converter"
abstract: "Sitecore Data Exchange Frameworkでアイテムをプラグインに変換するためのパイプラインステップコンバーターの実装方法。"
---
# パイプラインステップコンバータの実装

パイプラインステップの項目の設定をプラグインに変換するにはコンバーターを使う必要があります。プラグインはパイプラインステップが読み取るエンドポイントを特定します。

パイプラインステップコンバータの実装方法:

1.  Visual Studioで、次のクラスを追加します:
    
    using Sitecore.DataExchange.Attributes;
    using Sitecore.DataExchange.Converters.PipelineSteps;
    using Sitecore.DataExchange.Models;
    using Sitecore.DataExchange.Plugins;
    using Sitecore.DataExchange.Repositories;
    using Sitecore.Services.Core.Model;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Examples.DataExchange.Providers.FileSystem
    {
     SupportedIds(ReadTextFileStepTemplateId)
     public class ReadTextFileStepConverter : BasePipelineStepConverter
     {
     public const string ReadTextFileStepTemplateId = "PIPELINE STEP TEMPLATE ID";
     public const string TemplateFieldEndpointFrom = "EndpointFrom";
     public ReadTextFileStepConverter(IItemModelRepository repository) : base(repository)
     {
     }
     protected override void AddPlugins(ItemModel source, PipelineStep pipelineStep)
     {
     //
     //create the plugin
     var settings = new EndpointSettings
     {
     //
     //populate the plugin using values from the item
     EndpointFrom = this.ConvertReferenceToModel<Endpoint>(source, TemplateFieldEndpointFrom)
     };
     //
     //add the plugin to the pipeline step
     pipelineStep.AddPlugin(settings);
     }
     }
    }
    
    > !重要PIPELINE STEP TEMPLATE IDの値を、パイプラインステップテンプレートの *「Read Text File Pipeline Step*」のIDに合わせて変更する必要があります。
    
    > !注BasePipelineStepConverter(base-pipeline-step-converter.html "Base pipeline step converter") から継承することで、Sitecore項目のフィールドから値を読み取るのを容易にする多くの手法にアクセスできます。
    > 
    > 文字列、数字、日付などの単純な値を読み取れるだけでなく、参照された項目を自動的に適切なData Exchange Frameworkコンポーネントに変換するメソッドも利用可能です。
    
2.  プロジェクトをコンパイルします。
    
3.  Examples.DataExchange.Providers.FileSystem.dllをSitecoreサーバーにデプロイしてください。