カスタムストレージプロバイダーとプロファイルの例

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

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

カスタムプロバイダーおよびプロファイルを導入するために:

  1. カスタムプロバイダーを導入します。IStorageProviderから継承したデータの保存方法を実装する必要があります。

    using Sitecore.XConnect.DataTools.CortexWorkers.DataExport.StorageProviders; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks;

    namespace CortexWorkers.DataExport.StorageProviders.Examples { internal class CustomProvider : IStorageProvider { public CustomProvider(IEnumerable profiles) { Profiles = profiles == null ? new Dictionary<string, CustomProfile>() : profiles.ToDictionary(x => x.ProfileName, x => x); } public IReadOnlyCollection ProfileNames => Profiles.Keys; protected Dictionary<string, CustomProfile> Profiles { get; } protected CustomProfile GetProfile(string profileName) { if (!Profiles.TryGetValue(profileName, out CustomProfile profile)) { throw new InvalidOperationException(); } return profile; } public Task UploadAsync(string fileName, string fileContent, string profileName, CancellationToken cancellationToken) { /*Implement the logic of the custom provider*/ } } }

  2. 特定のストレージパラメータを定義するカスタムストレージプロファイルを導入します。適切なプロファイルを特定するためにProfileNameパラメータを追加する必要があります。

    using System; using System.Globalization; using Microsoft.Extensions.Configuration;

    namespace CortexWorkers.DataExport.StorageProviders.Examples { internal class CustomProfile { public CustomProfile(IConfiguration options) : this((options ?? throw new ArgumentNullException(nameof(options))).GetValue(nameof(ProfileName)), options.GetValue(nameof(Param1)), options.GetValue(nameof(Param2)), options.GetValue(nameof(Param3))) { } public CustomProfile(string profileName, string param1, string param2, string param3) { if (string.IsNullOrWhiteSpace(profileName)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Looks up a localized string similar to The {0} is not valid..", nameof(profileName))); } if (string.IsNullOrWhiteSpace(param1)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Looks up a localized string similar to The {0} is not valid..", nameof(param1))); } if (string.IsNullOrWhiteSpace(param2)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Looks up a localized string similar to The {0} is not valid..", nameof(param2))); } if (string.IsNullOrWhiteSpace(param3)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Looks up a localized string similar to The {0} is not valid..", nameof(param3))); } ProfileName = profileName; Param1 = param1; Param2 = param2; Param3 = param3; } public string ProfileName { get; } public string Param1 { get; } public string Param2 { get; } public string Param3 { get; } } }

  3. Cortex Processingの役割とProcessing Engineサービス構成Sitecore\Processing\Servicesセクションを新しいカスタムプロバイダーとプロファイルでパッチしてください。

    CortexWorkers.DataExport.StorageProviders.Examples.CustomProfile, CortexWorkers.DataExport.StorageProviders.Examples CortexWorkers.DataExport.StorageProviders.Examples.CustomProfile, CortexWorkers.DataExport.StorageProviders.Examples Singleton CustomProfile Value1 Value2 Value3 CortexWorkers.DataExport.StorageProviders.Examples.CustomProvider, CortexWorkers.DataExport.StorageProviders.Examples Sitecore.XConnect.DataTools.CortexWorkers.DataExport.StorageProviders.IStorageProvider, Sitecore.XConnect.DataTools.CortexWorkers Singleton
  4. ソリューションを構築しましょう。DLLファイルをCortex Processingの役割とProcessing Engineサービスに追加してください。

  5. 変更を適用するには、Processing Engineサービスを再起動してください。

現在では、CustomProfileをDataExport Toolに渡し、新しいカスタムプロバイダーでアップロードを実行することが可能になりました。

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