Index table migration
This article covers process of migrating index table from old format (used in versions 3 and older) to new format (used in versions 5 and newer).
Migration can be done in multiple ways:
- Manually using "Portos eKasa servis" application
- Programatically using
MigrationManager
class located inNineDigit.eKasa.StorageManagement
NuGet package.
Manual approach
- Open "Portos eKasa servis" application.
- Make sure the protected memory (CHDU) is connected to the computer.
- Click on "MIGROVAŤ TABUĽKU INDEXOV" button in "Tabuľka indexov" section on home screen ("Prehľad")
- Choose whether index table will be located automatically ("Automaticky vyhľadať tabuľku indexov") or whether you want to specify index table file path explicitly ("Vybrať tabuľku indexov").
- Click confirm button ("POTVRDIŤ").
Programmatic approach
Locate index table automatically based on configuration file
// default path to the confiuration file
string configurationFilePath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"NineDigit",
"Portos.eKasa",
"settings.json");
// please see article dedicated to logging to provide real logger.
ILoggerFactory loggerFactory = NullLoggerFactory.Instance;
// create migration manager instance
MigrationManager migrationManager = new MigrationManager(loggerFactory);
// migration manager look up index table file path based on provided configuration
await migrationManager.MigrateAsync(configurationFilePath, CancellationToken.None);
Specify file to migrate explicitly
// please see article dedicated to logging to provide real logger.
ILoggerFactory loggerFactory = NullLoggerFactory.Instance;
// create migration manager instance
MigrationManager migrationManager = new MigrationManager(loggerFactory);
MigrationContext migrationContext = new MigrationContext("path-to-the-index-table.dat")
{
// The `StorageModel` and `StorageSerialNumber` properties are optional.
// They will be readed from connected device, if not specified.
StorageModel = StorageModel.ChduSk, // optional
StorageSerialNumber = "3651181395" // optional
};
await migrationManager.MigrateAsync(migrationContext, CancellationToken.None);