private string DoConversion()
        {
            Logger.Info("Doing conversion");

            List <string> scriptNames = new List <string>();
            Dictionary <string, string> bcpExportCommands = new Dictionary <string, string>();
            Dictionary <string, string> bcpImportCommands = new Dictionary <string, string>();

            _destinationDatabase.Tables.ForEach(t =>
            {
                DestinationTable destinationTable = t;
                SourceTable sourceTable           = null;
                try
                {
                    Logger.Info("Processing " + destinationTable.Name);

                    TableMappingConfiguration mappingConfig = GetTableMappingConfig(destinationTable.Name);
                    sourceTable               = GetSourceTable(destinationTable.Name, mappingConfig);
                    var mappingDefinition     = CreateTableMappingDefinition(sourceTable, destinationTable, mappingConfig);
                    SqlGenerator sqlGenerator = new SqlGenerator(mappingDefinition, _options.CheckExistData);
                    BcpGenerator bcpGenerator = new BcpGenerator(_options.ServerName, _options.InstanceName, mappingDefinition, _options.BcpMode);

                    HandleBcp(sqlGenerator, bcpGenerator, mappingDefinition, bcpExportCommands, bcpImportCommands);
                    HandleMaxTextUpdate(sqlGenerator, mappingDefinition, scriptNames);
                    if (_options.BlobHandling)
                    {
                        HandleBlobUpdate(sqlGenerator, mappingDefinition, scriptNames);
                    }
                }
                catch (AppException ex)
                {
                    if (ex.ErrorCode == AppExceptionCodes.DATABASE_ERROR_TABLE_NOT_FOUND)
                    {
                        Logger.Warn(destinationTable.Name + " not mapped");
                    }
                }
            });

            // Generate bat file
            string exportScript = BatGenerator.GenerateBcpExecuteBat(bcpExportCommands);

            SaveToFile(_packageOutputPath, "BCP_Export.bat", exportScript);
            Logger.Info("BCP Exporting data");
            Process.Start(new ProcessStartInfo {
                WorkingDirectory = _packageOutputPath, FileName = "BCP_Export.bat"
            });

            string importScript = BatGenerator.GenerateBcpExecuteBat(bcpImportCommands);
            //SaveToFile(_packageOutputPath, "BCP_Import.bat", importScript);

            List <string> scriptPaths  = scriptNames.Select(s => Path.Combine(CONVERSION_PACKAGE_FOLDER, s)).ToList();
            string        updateScript = BatGenerator.GenerateSqlExecuteBat(scriptPaths, _options.ServerName, _options.InstanceName, _options.Username, _options.Password);
            //SaveToFile(_packageOutputPath, "Update_Blob_Text.bat", updateScript);

            string batScript = importScript + Environment.NewLine + updateScript;

            return(batScript);
        }
        private string DoPostConversion()
        {
            Logger.Info("Doing post-conversion job");

            foreach (string filePath in _listPostConversionScript)
            {
                string destPath = Path.Combine(_packageOutputPath, POST_CONVERSION_PACKAGE_FOLDER, Path.GetFileName(filePath));
                File.Copy(filePath, destPath);
            }

            List <string> scriptPaths  = _listPostConversionScript.Select(s => Path.Combine(POST_CONVERSION_PACKAGE_FOLDER, Path.GetFileName(s))).ToList();
            string        updateScript = BatGenerator.GenerateSqlExecuteBat(scriptPaths, _options.ServerName, _options.InstanceName, _options.Username, _options.Password);

            //SaveToFile(_packageOutputPath, "Run_Post_Conversion.bat", updateScript);

            return(updateScript);
        }