Represents a script repository that stores build scripts in a distributed version control system.
The build script files in the distributed version repository must be organized with the same structure as required by FileSystemScriptRepository. The root location must contain subdirectories for each database schema, each named with the name of the schema. Within those directories should be a directory for each database object type: Function, Procedure, Type, View. Within those directories should be the build scripts, with file names ending with ".sql". The name of each file should be the same name as the database object it creates.
상속: FileSystemScriptRepository
예제 #1
0
        private async Task Build(IEnumerable<BuildItem> items, DatabaseSetting dbSetting, DvcsScriptRepositoryBase.RevisionIdentifierBase sourceChangeset)
        {
            using (var connection = new SqlConnection(dbSetting.ConnectionString))
            {
                await connection.OpenAsync();
                using (var transaction = connection.BeginTransaction())
                {
                    var db = dbSetting.Create(connection, transaction);
                    
                    if (await db.BuildAsync(items))
                    {
                        transaction.Commit();
                    }
                }
            }

            await DispatcherInvoke(() =>
                {
                    ((MainWindowViewModel)DataContext).IsReady = true;
                    ((MainWindowViewModel)DataContext).IsDone = true;
                    var vm = ((MainWindowViewModel)DataContext);
                    Properties.Settings.Default.LastChangeset = vm.SourceChangeset as DvcsScriptRepositoryBase.ChangesetId;
                    Properties.Settings.Default.LastTag = vm.SourceChangeset as DvcsScriptRepositoryBase.Tag;
                    Properties.Settings.Default.Save();
                });
        }
예제 #2
0
        private async Task Update(DatabaseSetting dbSetting, DvcsScriptRepositoryBase.RevisionIdentifierBase sourceChangeset)
        {
            ICollection<BuildItem> buildItems;
            using (var connection = new SqlConnection(dbSetting.ConnectionString))
            {
                await connection.OpenAsync();
                using (var transaction = connection.BeginTransaction())
                {
                    var fileSystem = new FileSystem();
                    var db = dbSetting.Create(connection, transaction);
                    var gitProcess = new ExternalProcess(pathToGit.FullName);
                    var dvcsScriptRepo = new GitScriptRepository(dbSetting.ScriptsPath, dbSetting.ServerName, dbSetting.DatabaseName, gitProcess, fileSystem, sqlParser, new ConsoleLogger(SeverityLevel.Warning), false);
                    dvcsScriptRepo.SourceChangeset = sourceChangeset;

                    buildItems = await db.GetChangedBuildItemsAsync(dvcsScriptRepo);
                    transaction.Commit();
                }
            }

            await DispatcherInvoke(() =>
            {
                ((MainWindowViewModel)DataContext).IsReady = true;
                ((MainWindowViewModel)DataContext).IsDone = false;
                ObservableCollection<BuildItemViewModel> itemsCollection = new ObservableCollection<BuildItemViewModel>
                    (buildItems.Select(x => new BuildItemViewModel(x, Dispatcher)));
                ((MainWindowViewModel)DataContext).Items = itemsCollection;
            });
        }