Custom storage provider and profile
You can create custom sets of storage providers and profiles to use with the xConnect Data Export Tool. You use custom providers to export data into your own storage environments, such as a NAS or a cloud provider that Sitecore does not include by default.
To create a custom set:
-
In Visual Studio, create a new project. Make sure it inherits the
IStorageProviderinterface. Define the logic for how data files are stored in the intended storage. For example:RequestResponse/// <summary> /// Defines an interface for data storage providers. /// All the new storage providers must be inherited from this interface. /// </summary> public interface IStorageProvider { /// <summary> /// Gets the profile names that linked to the storage provider. /// Profile is named set of specific provider properties, for instance /// path to specific folder, credentials to establish connection to the storage, etc. /// </summary> IReadOnlyCollection<string> ProfileNames { get; } /// <summary> /// Uploads file with specified file name and content to the storage defined in /// the profile asynchronously. /// </summary> /// <param name="fileName">The file name.</param> /// <param name="fileContent">The file content.</param> /// <param name="profileName">The profile name.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>The task.</returns> Task UploadAsync(string fileName, string fileContent, string profileName, CancellationToken cancellationToken); } -
Create a storage profile. The storage profile must inherit the
IStorageProfileinterface that requires only a profile name property to be specified. For example:RequestResponseinternal interface IStorageProfile { string ProfileName { get; } } -
In the storage profile, add the required properties for the storage provider type.
The profiles must be injected into the Storage Provider, the UploadAsync method is responsible for getting proper profile by the specified profile name to get the storage settings.