public override Execution ContinueWith(ITaskExecutionContext <MaintenanceWorkItem> context)
        {
            UCommerceMaintenanceConfiguration configuration = context.EnsureConfiguration(_configuration);

            if (!configuration.IndexMaintenance.Enabled)
            {
                return(Execution.StepOver);
            }

            return(base.ContinueWith(context));
        }
        public override void Execute(ITaskExecutionContext <MaintenanceWorkItem> context)
        {
            UCommerceMaintenanceConfiguration configuration = context.EnsureConfiguration(_configuration);

            string script = BuildScript(configuration);

            if (script.Length > 0)
            {
                context.Log.Message(@"Executing sql: {0}", script);

                using (IDbConnection connection = _uCommerceDb.GetConnection())
                {
                    connection.Open();

                    var command = new CommandDefinition(
                        script,
                        cancellationToken: context.CancellationToken,
                        commandTimeout: configuration.IndexMaintenance.CommandTimeout.GetValueOrDefault(int.MaxValue));

                    connection.ExecuteAsync(command).Wait(context.CancellationToken);
                }
            }
        }