Skip to content

LitiumAB/Litium.Synchronization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Litium.Synchronization

About

Litium.Synchronization is a tool to move Customers and Orders from one Litium installation to another without dependency on Litium version.

This is useful during upgrades where the old installation can export all added information to the new environment as it is being added. At go live all traffic can be redirected to the new environment that already has all the data.

Litium.Synchronization is not a versioned addon, Litium does not maintain and upgrade the code for each new release of the platform. The code need to be tested before use in a production scenario.

Version support

Litium.Synchronization.Export.L5 has references to Litium 5.6.8 and Litium.Synchronization.Import has references to Litium 7.4.1.

Adjust if you upgrade is between other Litium versions (only versions specified above are tested)

Installation

  1. Install nuget package references and compile the solution.

  2. Add the following to appsettings of the web.config of the site that should be upgraded.

    <add key=" SynchronizationExportFolder" value="Path to folder where exports will be added" />
  3. Copy Litium.Synchronization.Abstraction.dll and Litium.Synchronization.Export.L5.dll to the bin folder of the site to upgrade. Do not copy the config files.

  4. Clone your site upgrade the clone to litium the new Litium version.

  5. Add the following to appsettings in web.config of your upgraded installation.

    This configuration will add a prefix to orders and deliveries so that the orders that created in the upgraded version will not conflict with the orders that you are synchronizing.

    <add key="SynchronizationImportFolder" value="Path to folder where exports are added" />
    <add key="Litium:Sales:OrderNumberPrefix" value="Test" />
    <add key="Litium:Sales:DeliveryNumberPrefix" value="TestD" />
  6. Add the following validator to the upgraded Accelerator project so that persons created in the upgraded version will not conflict with the orders that are synchronized.

    public class PersonIdValidator : ValidationRuleBase<Person>
    {
        public override ValidationResult Validate(Person entity, ValidationMode validationMode)
        {
            if (string.IsNullOrWhiteSpace(entity.Id))
            {
                var id = Guid.NewGuid().ToString("N");
                entity.Id = $"Test{id}" ;
            }
            return new ValidationResult();
        }
    }
  7. Add a similar validator for organziations

    public class OrganizationIdValidator : ValidationRuleBase<Organization>
    {
        public override ValidationResult Validate(Organization entity, ValidationMode validationMode)
        {
            if (string.IsNullOrWhiteSpace(entity.Id))
            {
                var id = Guid.NewGuid().ToString("N");
                entity.Id = $"Test{id}" ;
            }
            return new ValidationResult();
        }
    }
  8. Add the following ScheduledJobs to web.config of the upgraded solution

    <scheduledTask type="Litium.Synchronization.Import.Tasks.OrderImport, Litium.Synchronization.Import" startTime="00:00" interval="1m" parameters="MaxArchiveAgeInDays=7,MaxErrorAgeInMonths=1" />
    <scheduledTask type="Litium.Synchronization.Import.Tasks.OrganizationImport, Litium.Synchronization.Import" startTime="00:00" interval="1m" parameters="MaxArchiveAgeInDays=7,MaxErrorAgeInMonths=1" />
    <scheduledTask type="Litium.Synchronization.Import.Tasks.PersonImport, Litium.Synchronization.Import" startTime="00:00" interval="1m" parameters="MaxArchiveAgeInDays=7,MaxErrorAgeInMonths=1" /> 
  9. Copy Litium.Synchronization.Abstraction.dll and Litium.Synchronization.Import.dll to the upgraded solution

Before go live

  1. Ensure that all data has been imported to the new environment

  2. Remove following appsettings before go live

    <add key="Litium:Sales:OrderNumberPrefix" value="Test" />
    <add key="Litium:Sales:DeliveryNumberPrefix" value="TestD" />
  3. Remove the ValidationRules for persons and organizations from the solution

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages