パイプラインステップコンバータの実装
このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。
パイプラインステップの項目の設定をプラグインに変換するにはコンバーターを使う必要があります。プラグインはパイプラインステップが読み取るエンドポイントを特定します。
パイプラインステップコンバータの実装方法:
-
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
(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コンポーネントに変換するメソッドも利用可能です。
-
プロジェクトをコンパイルします。
-
Examples.DataExchange.Providers.FileSystem.dllをSitecoreサーバーにデプロイしてください。