private static IEnumerable <ICommand> CreatePostReplicationCommands(TableName table, DbManagementMode mode)
        {
            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                yield return(new EnableIndexesCommand(table));
            }

            if (mode.HasFlag(DbManagementMode.UpdateTableStatistics))
            {
                yield return(new UpdateTableStatisticsCommand(table));
            }
        }
        private static IEnumerable <ICommand> CreatePreReplicationCommands(TableName table, DbManagementMode mode)
        {
            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                yield return(new DisableIndexesCommand(table));
            }

            if (mode.HasFlag(DbManagementMode.TruncateTable))
            {
                yield return(new TruncateTableCommand(table));
            }
        }
        private static IReadOnlyCollection <ICommand> CreateSchemaChangesCommands(DbManagementMode mode)
        {
            var commands = new List <ICommand>();

            if (mode.HasFlag(DbManagementMode.DropAndRecreateViews))
            {
                commands.Add(new DropViewsCommand());
            }

            if (mode.HasFlag(DbManagementMode.DropAndRecreateConstraints))
            {
                commands.Add(new DisableConstraintsCommand());
            }

            return(commands);
        }
        private static IReadOnlyCollection <ICommand> CreateReplicationCommands(TableName table, TimeSpan bulkCopyTimeout, DbManagementMode mode)
        {
            var commands = new List <ICommand>();

            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                commands.Add(new DisableIndexesCommand(table));
            }

            commands.Add(new TruncateTableCommand(table));
            commands.Add(new BulkInsertDataObjectsCommand(bulkCopyTimeout));

            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                commands.Add(new EnableIndexesCommand(table));
            }

            if (mode.HasFlag(DbManagementMode.UpdateTableStatistics))
            {
                commands.Add(new UpdateTableStatisticsCommand(table));
            }

            return(commands);
        }
        private static IReadOnlyCollection <ICommand> CreateShadowReplicationCommands(TableName table, TimeSpan bulkCopyTimeout, DbManagementMode mode)
        {
            var createTableCopyCommand = new CreateTableCopyCommand(table);
            var commands = new List <ICommand>
            {
                createTableCopyCommand,
                new DisableIndexesCommand(createTableCopyCommand.TargetTable),
                new BulkInsertDataObjectsCommand(bulkCopyTimeout, CreateTableCopyCommand.Prefix),
                new EnableIndexesCommand(createTableCopyCommand.TargetTable)
            };

            if (mode.HasFlag(DbManagementMode.UpdateTableStatistics))
            {
                commands.Add(new UpdateTableStatisticsCommand(createTableCopyCommand.TargetTable));
            }

            return(commands);
        }
예제 #6
0
        private static IReadOnlyCollection<ICommand> CreateReplicationCommands(TableName table, TimeSpan bulkCopyTimeout, DbManagementMode mode)
        {
            var commands = new List<ICommand>();
            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                commands.Add(new DisableIndexesCommand(table));
            }

            commands.Add(new TruncateTableCommand(table));
            commands.Add(new BulkInsertDataObjectsCommand(bulkCopyTimeout));

            if (mode.HasFlag(DbManagementMode.EnableIndexManagment))
            {
                commands.Add(new EnableIndexesCommand(table));
            }

            if (mode.HasFlag(DbManagementMode.UpdateTableStatistics))
            {
                commands.Add(new UpdateTableStatisticsCommand(table));
            }

            return commands;
        }
예제 #7
0
        private static IReadOnlyCollection<ICommand> CreateSchemaChangesCommands(DbManagementMode mode)
        {
            var commands = new List<ICommand>();
            if (mode.HasFlag(DbManagementMode.DropAndRecreateViews))
            {
                commands.Add(new DropViewsCommand());
            }

            if (mode.HasFlag(DbManagementMode.DropAndRecreateConstraints))
            {
                commands.Add(new DisableConstraintsCommand());
            }

            return commands;
        }