---
title: "エンドポイントコンバータを実装する"
slug: "implement-an-endpoint-converter"
abstract: "SitecoreのアイテムをSitecore Data Exchange Frameworkのコンポーネントに変換する方法。"
---
# エンドポイントコンバータを実装する

コンポーネントを表すSitecoreアイテムを実際のコンポーネントに変換するにはコンバーターが必要です。この例では、コンバーターがエンドポイントアイテムの設定をエンドポイント設定プラグインに変換します。そのプラグインをエンドポイントに追加できます。

エンドポイントコンバータを実装するには:

1.  Visual Studioで、次のクラスを追加します:
    
    using Sitecore.DataExchange.Attributes;
    using Sitecore.DataExchange.Converters.Endpoints;
    using Sitecore.DataExchange.Models;
    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(TextFileEndpointTemplateId)
     public class TextFileEndpointConverter : BaseEndpointConverter
     {
     public const string TextFileEndpointTemplateId = "ENDPOINT TEMPLATE ID";
     public const string TemplateFieldColumnSeparator = "ColumnSeparator";
     public const string TemplateFieldColumnHeadersInFirstLine = "ColumnHeadersInFirstLine";
     public const string TemplateFieldPath = "Path";
     public TextFileEndpointConverter(IItemModelRepository repository) : base(repository)
     {
     }
     protected override void AddPlugins(ItemModel source, Endpoint endpoint)
     {
     //
     //create the plugin
     var settings = new TextFileSettings
     {
     //
     //populate the plugin using values from the item
     ColumnHeadersInFirstLine = this.GetBoolValue(source, TemplateFieldColumnHeadersInFirstLine),
     ColumnSeparator = this.GetStringValue(source, TemplateFieldColumnSeparator),
     Path = this.GetStringValue(source, TemplateFieldPath)
     };
     //
     //add the plugin to the endpoint
     endpoint.AddPlugin(settings);
     }
     }
    }
    
    > !重要ENDPOINT TEMPLATE IDの値を、*Text File Endpoint*という名前のエンドポイントテンプレートのIDに合わせて変更しなければなりません。
    
    > !注BaseEndpointConverter(base-endpoint-converter.html "Base endpoint converter") から継承することで、Sitecore項目のフィールドから値を読み取るのを容易にする多くの手法にアクセスできます。
    
2.  プロジェクトをコンパイルします。
    
3.  Examples.DataExchange.Providers.FileSystem.dllをSitecoreサーバーにデプロイしてください。