예제 #1
0
        public Task RunAsync()
        {
            return(Task.Run(() =>
            {
                try
                {
                    var context = _migrationsRepository.GetRunnerContext(Name, Tags, false);
                    using (var processor = _migrationsRepository.GetMigrationProcessor(_project.DatabaseType.Value, _project.ConnectionString, context))
                    {
                        var runner = new MigrationRunner(_project.MigrationsAssembly, context, processor);

                        var sw = new Stopwatch();
                        sw.Start();

                        runner.ApplyProfiles();

                        sw.Stop();

                        _log.Info("Successfully ran profile '{0}', took {1}", Name, sw.Elapsed);
                    }
                }
                catch (Exception e)
                {
                    throw new ProfileException("Could not run profile", e, this);
                }
            }));
        }