Example #1
0
        public static void ProcessMergeTables(DAL master,
                                              IEnumerable <ComponentFile> components,
                                              IEnumerable <MergeTableCommandBuilder> commandBuilders,
                                              CancellationToken cancellation,
                                              IProgress <int> progress,
                                              IMergeLog log)
        {
            log?.StartJob();
            master.BeginTransaction();
            try
            {
                foreach (MergeTableCommandBuilder cmdBldr in commandBuilders)
                {
                    cancellation.ThrowIfCancellationRequested();
                    ProcessMergeTable(master, cmdBldr, components, log);
                }

                master.CommitTransaction();
                log?.EndJob();
            }
            catch
            {
                master.RollbackTransaction();
                throw;
            }
        }
Example #2
0
        public static void MakeMergeTables(
            DAL master,
            IEnumerable <MergeTableCommandBuilder> commandBuilders,
            CancellationToken cancellation,
            IProgress <int> progress,
            IMergeLog log)
        {
            log?.StartJob();
            var unitsOfWork = commandBuilders.Count();

            master.BeginTransaction();
            try
            {
                var i = 0;
                foreach (MergeTableCommandBuilder cmdBldr in commandBuilders)
                {
                    log?.PostStatus("Create " + cmdBldr.MergeTableName);

                    master.Execute("DROP TABLE IF EXISTS " + cmdBldr.MergeTableName + ";");
                    master.Execute(cmdBldr.MakeMergeTableCommand);
                    progress?.Report((++i * 100) / unitsOfWork);
                }

                master.CommitTransaction();
            }
            catch
            {
                master.RollbackTransaction();
                throw;
            }
        }
Example #3
0
        public static void PopulateMergeTables(
            DAL master,
            IEnumerable <ComponentFile> components,
            IEnumerable <MergeTableCommandBuilder> commandBuilders,
            CancellationToken cancellation,
            IProgress <int> progress,
            IMergeLog log)
        {
            log?.StartJob();

            foreach (var comp in components)
            {
                PopulateMergeTables(master, comp, commandBuilders, cancellation, progress, log);
            }
            log?.EndJob();
        }