Beispiel #1
0
        private TSqlModel CreateFilteredModel(SchemaBasedFilter schemaFilter, TSqlModel model)
        {
            ModelFilterer modelFilterer = new ModelFilterer(schemaFilter);

            TSqlModel filteredModel = modelFilterer.CreateFilteredModel(model);
            _trash.Add(filteredModel);
            return filteredModel;
        }
Beispiel #2
0
        public void TestUpdateDacpacWithFilteredModel()
        {
            // Given a model with objects that use "dev", "test" and "prod" schemas
            var model = CreateTestModel();
            string existingPackagePath = GetTestFilePath("original.dacpac");
            BuildPackage(model, existingPackagePath);

            // When saving a dacpac for deployment to production (filtering to exclude "dev" and "test" schemas)
            var schemaFilter = new SchemaBasedFilter("dev", "test");
            ModelFilterer modelFilterer = new ModelFilterer(schemaFilter);

            modelFilterer.UpdateDacpacModelWithFilter(existingPackagePath);

            // Then expect only the "prod" schema objects to remain in the new package
            var filteredModel = _trash.Add(new TSqlModel(existingPackagePath));
            Assert.AreEqual(TopLevelProdElementCount, CountTablesViewsAndSchemas(filteredModel));
        }