示例#1
0
        /// <summary>
        /// Main
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //
            // Initialize source and destination database
            Initialize(args);
            EclipseDatabase   source      = new EclipseDatabase();
            BOALedgerDatabase destination = new BOALedgerDatabase();
            MappingManager    manager     = new MappingManager(source, destination);


            //
            // Check we need to validate or not
            if (args.Contains("/report-data-errors"))
            {
                LogService.Log.Info("Running data validation.");
                ValidationManager validationManager = new ValidationManager();
                validationManager.Validate <OrphanRecordValidation>(manager, source, destination);
                return;
            }


            //
            // Check we need to extract to sql script or not
            manager.ConfigAutoMapper(new EclipseToBOALedgerProfile());
            ConfigureManualMapping(manager);
            ConfigurePostMigrationScript(manager);
            manager.ChangeName("ledgers", "gl_ledgers");
            SetRunningMode(manager, args);


            //
            // Start mapping
            try
            {
                manager.Map();
                if (manager.IsGeneratedScript)
                {
                    RunBatFile(manager);
                }
            }
            catch (Exception exc)
            {
                LogService.Log.Error("Error occurs when mapping. Terminated.", exc);
            }
        }