public void Execute()
        {
            using (var connection = new SqlConnection(@""))
            {
                connection.Open();

                var outputSerializer = new XmlSerializer(typeof(DataSchemaModel));
                var extractor        = new SqlPublicationExtractor();
                outputSerializer.Serialize(new FileStream(@"Samples\Extracted Model.xml", FileMode.Create), extractor.Extract(connection));
            }
        }
        public void RecreateExistingPublication()
        {
            using (var connection = new SqlConnection(@""))
            {
                connection.Open();

                var extractor = new SqlPublicationExtractor();
                var model     = extractor.Extract(connection);

                var step = new CreatePublicationStep(model.Model.Elements[0]);
                var sql  = step.GenerateTSQL();

                foreach (var line in sql)
                {
                    Console.WriteLine(line);
                }
            }
        }
        static void Extract(Options options)
        {
            if (string.IsNullOrEmpty(options.SourceServerName))
            {
                throw new CommandLineRequiredArgumentMissingException(typeof(Options), "SourceServerName", -1);
            }

            if (string.IsNullOrEmpty(options.SourceDatabaseName))
            {
                throw new CommandLineRequiredArgumentMissingException(typeof(Options), "SourceDatabaseName", -1);
            }

            if (string.IsNullOrEmpty(options.SourceUser))
            {
                throw new CommandLineRequiredArgumentMissingException(typeof(Options), "SourceUser", -1);
            }

            if (string.IsNullOrEmpty(options.SourcePassword))
            {
                throw new CommandLineRequiredArgumentMissingException(typeof(Options), "SourcePassword", -1);
            }

            if (string.IsNullOrEmpty(options.TargetFile))
            {
                throw new CommandLineRequiredArgumentMissingException(typeof(Options), "TargetFile", -1);
            }

            var augmentor = new SqlPublicationDacpacAugmentor();
            var extractor = new SqlPublicationExtractor();

            var connectionString = string.Format("Data Source={0};Initial Catalog={1};UID={2};Password={3};MultipleActiveResultSets=True",
                                                 options.SourceServerName, options.SourceDatabaseName, options.SourceUser,
                                                 options.SourcePassword);

            augmentor.Augment(options.TargetFile, extractor.Extract(connectionString));
        }