Data Import
The data importer is a great tool for importing data from external sources. It can be used for the initial setup of a project or scheduled synchronization with a third-party application.
What the Data Importer Does
Getting Started
dotnet add package Ucommerce.DataImport.Corevar elements = data.Skip(batchNumber * batchSize).Take(batchSize);public class MyCurrencyFetcher : ICurrencyFetcher
{
public virtual Task<IReadOnlyList<CurrencyData>> GetCurrencyData(int batchNumber, int batchSize)
{
var filePath = "currencies.csv";
using var reader = new StreamReader(filePath);
using var csv = new CsvReader(reader, config);
csv.Context.RegisterClassMap(new CurrencyMap());
var records = csv.GetRecords<CurrencyData>();
records = records.Skip(batchNumber * batchSize)
.Take(batchSize);
return Task.FromResult<IReadOnlyList<CurrencyData>>(records.ToImmutableList());
}
}Registering the Fetcher(s)
Setting up the Data Importer
Running the Data Importer
Community contributed implementations
Last updated