Exemplo n.º 1
0
        /// <summary>
        ///		Ejecuta un paso
        /// </summary>
        protected override async Task <bool> ProcessStepAsync(List <JobContextModel> contexts, JobStepModel step, NormalizedDictionary <object> parameters,
                                                              CancellationToken cancellationToken)
        {
            bool processed = false;
            DbAggregatorManager dataProviderManager = GetProviderManager(contexts, step);

            // Procesa el paso
            using (BlockLogModel block = Logger.Default.CreateBlock(LogModel.LogType.Debug, $"Start execute step {step.Name}"))
            {
                if (string.IsNullOrEmpty(step.ScriptFileName) || !System.IO.File.Exists(step.ScriptFileName))
                {
                    block.Error($"Cant find the file {step.ScriptFileName}");
                }
                else
                {
                    DbScriptManager scriptManager = new DbScriptManager(step, dataProviderManager, parameters, Logger);

                    // Ejecuta el paso
                    if (System.IO.Path.GetExtension(step.ScriptFileName).EqualsIgnoreCase(".sql"))
                    {
                        processed = await scriptManager.ProcessBySqlScriptAsync(step.Target, step.ScriptFileName, cancellationToken);
                    }
                    else
                    {
                        processed = await scriptManager.ProcessByFileAsync(step.ScriptFileName, cancellationToken);
                    }
                }
            }
            // Devuelve el valor que indica si se ha procesado correctamente
            return(processed);
        }
Exemplo n.º 2
0
 internal DbScriptProcessor(DbScriptManager manager)
 {
     Manager = manager;
 }