Beispiel #1
0
        static void Main(string[] args)
        {
            string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            Console.WriteLine("BV Migrate | " + version);
            Console.WriteLine();

            if (args.Length < 2)
            {
                ShowHelp();
                return;
            }

            Console.WriteLine("Parsing Arguments");

            MigrationSettings data = new MigrationSettings();

            foreach (string arg in args)
            {
                ParseArg(data, arg);
            }

            data.PrepArgs();

            MigrationService migrator = new MigrationService(data);
            migrator.ProgressReport += new MigrationService.ProgressReportDelegate(builder_ProgressReport);
            migrator.StartMigration();            
        }
Beispiel #2
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     MigrationSettings settings = (MigrationSettings)e.Argument;
     MigrationService svc = new MigrationService(settings);
     svc.ProgressReport += new MigrationService.ProgressReportDelegate(svc_ProgressReport);
     svc.StartMigration();            
 }
        /// <summary>
        /// Try really hard to populate this from a string
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        private MigrationOptions SetMigrationService(string key)
        {
            var options = _common.GetFromDisk<MigrationOptions>(key, Files.Options);

            if (options != null)
            {
                _migration = new MigrationService(options, new RemoteRequestService());

                return options;
            }

            return null;
        }
Beispiel #4
0
 /// <summary>
 /// Migrates the schema for the underlying database.
 /// </summary>
 public void MigrateSchema()
 {
     var availableChangeRepository = new LogDbSchemaChangeRepository();
     var appliedChangeRepository =
         new DbAppliedChangeRepository(
             Factory,
             ConnectionString);
     var migrationTarget =
         new DbTarget(
             Factory,
             ConnectionString);
     var service = new MigrationService();
     service.Migrate(
         availableChangeRepository,
         appliedChangeRepository,
         migrationTarget);
 }
 public static void Setup(string connectionString)
 {
     var availableChangeRepository =
         new BuildPipelineSchemaRepository();
     SQLiteFactory factory = SQLiteFactory.Instance;
     var appliedChangeRepository =
         new DbAppliedChangeRepository(
             factory,
             connectionString);
     var migrationTarget =
         new DbTarget(
             factory,
             connectionString);
     var service = new MigrationService();
     service.Migrate(
         availableChangeRepository,
         appliedChangeRepository,
         migrationTarget);
 }
        // THEN DO

        #region Listing & Child Page

        /// <summary>
        /// Iterate the items of a listing page to pull its pages and content
        /// </summary>
        /// <param name="key">The key of the options</param>
        /// <param name="url">The urls to crawl</param>
        /// <returns></returns>
        public async Task<bool> GetListings(string key, string url)
        {
            var options = SetMigrationService(key);

            if (options != null)
            {
                _migration = new MigrationService(options, new RemoteRequestService());

                if (!string.IsNullOrWhiteSpace(url))
                {
                    _migration.AddInitialUrls(new []{ url });

                    var results = await _migration.ProcessListing();

                    return results != null;
                }
            }

            return false;
        }
        public async Task<bool> GetDetails(string key, string[] urls)
        {
            var options = SetMigrationService(key);

            if (options != null)
            {
                _migration = new MigrationService(options, new RemoteRequestService());

                if (urls != null && urls.Any())
                {
                    _migration.AddInitialUrls(urls);

                    var results = await _migration.ProcessDetails();

                    return results != null;
                }
            }

            return false;
        }
        /// <summary>
        ///  Complete the pages pulled from the listing page and grab each pages individual details
        /// </summary>
        /// <param name="key">The key of the options</param>
        /// <returns></returns>
        public async Task<bool> GetListingsComplete(string key)
        {
            var options = SetMigrationService(key);

            if (options != null)
            {
                _migration = new MigrationService(options, new RemoteRequestService());

                _migration.LoadUrlsFromResults(key);

                var results = await _migration.ProcessDetails();

                return results != null;
            }

            return false;
        }