Esempio n. 1
0
 public static async Task ExecuteScript(this MySqlDatabase db, FileInfo sqlFile)
 {
     await ExecuteScript(db, File.ReadAllText(sqlFile.FullName));
 }
 public static Task ApplyAsync(string sqlFile, MySqlDatabase db, IProgress<int> progress, CancellationTokenSource cts)
 {
     return db.Restore(sqlFile, progress, cts.Token);
 }
        private void CreateBackup(string name, MySqlDatabase db, int intervalInMins)
        {

            IJobDetail job = JobBuilder.Create<BackupDBJob>()
                        .WithIdentity("backupjob_" + name, "backup")
                        .Build();

            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity("backupjob_" + name, "backup")
                .StartAt(DateBuilder.FutureDate(intervalInMins, IntervalUnit.Minute))
                .WithSimpleSchedule(x => x.RepeatForever().WithIntervalInMinutes(intervalInMins)).Build();

            job.JobDataMap["backupname"] = name;
            job.JobDataMap["backupdb"] = db;

            _scheduler.ScheduleJob(job, trigger);

            _triggers.Add(name, trigger.Key);

        }