トラブルシューターコンポーネントを構築する

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

トラブルシューターコンポーネントを作成するには:

  1. Visual Studioで、次のクラスを追加します。

    using Sitecore.DataExchange.Models;
    using Sitecore.DataExchange.Troubleshooters;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Examples.DataExchange.Providers.FileSystem
    {
        public class TextFileEndpointTroubleshooter : BaseEndpointTroubleshooter
        {
            public TextFileEndpointTroubleshooter()
            {
            }
            protected override ITroubleshooterResult Troubleshoot(Endpoint endpoint, TroubleshooterContext context)
            {
                var settings = endpoint.GetPlugin<TextFileSettings>();
                if (settings == null)
                {
                    return TroubleshooterResult.FailResult("The endpoint is missing the plugin TextFileSettings.");
                }
                if (string.IsNullOrWhiteSpace(settings.Path))
                {
                    return TroubleshooterResult.FailResult("The endpoint does not have a file path specified on it.");
                }
                if (!File.Exists(settings.Path))
                {
                    return TroubleshooterResult.FailResult(
                        "The path specified on the endpoint either " +
                        "points to a file that does not exist " +
                        "or the process does not have permission to read the file.");
                }
                return TroubleshooterResult.SuccessResult("The specified file exists and can be accessed.");
            }
        }
    }
    メモ

    このトラブルシューターは、Sitecore.DataExchange.Troubleshooters.BaseEndpointTroubleshooter.任意のタイプのコンポーネントに対してカスタムトラブルシューティングを作成するには、から継承Sitecore.DataExchange.Troubleshooters.ITroubleshooter

  2. プロジェクトをコンパイルします。

  3. Examples.DataExchange.Providers.FileSystem.dllをSitecoreサーバーにデプロイします。

この記事を改善するための提案がある場合は、 お知らせください!