Exemplo n.º 1
0
        public string Execute(DbUpdateArgs args)
        {
            _console.WriteLine("Starting the Resgrid Database Update Process");
            WriteConnectionString();

            _console.WriteLine("Please Wait...");

            try
            {
                var serviceProvider = CreateServices();

                // Put the database update into a scope to ensure
                // that all resources will be disposed.
                using (var scope = serviceProvider.CreateScope())
                {
                    UpdateDatabase(scope.ServiceProvider);
                }

                _console.WriteLine("Completed updating the Resgrid Database!");
            }
            catch (Exception ex)
            {
                _console.WriteLine("There was an error trying to update the Resgrid Database, see the error output below:");
                _console.WriteLine(ex.ToString());
            }


            return("");
        }
Exemplo n.º 2
0
        public string Execute(DbUpdateArgs args)
        {
            _console.WriteLine("Starting the Resgrid Database Update Process");
            _console.WriteLine("Please Wait...");

            try
            {
                Database.SetInitializer(new MigrateDatabaseToLatestVersion <Repositories.DataRepository.Contexts.DataContext, Configuration>());
                var migrator = new DbMigrator(new Repositories.DataRepository.Migrations.Configuration());
                migrator.Update();

                _console.WriteLine("Completed updating the Resgrid Database!");
            }
            catch (Exception ex)
            {
                _console.WriteLine("There was an error trying to update the Resgrid Database, see the error output below:");
                _console.WriteLine(ex.ToString());
            }


            return("");
        }