How to edit the SchemaCompare Settings in the SchemaComparison object?
$SchemaComparison = [SchemaComparison]::new( $SourceEndPoint, $TargetEndPoint ) $SchemaComparison.Options = $DeployOptions
I am particularly looking to Remove Database options, but the SchemaCompare settings do not appear to be accessible by code:
$SchemaComparison.Options.ExcludeDatabaseOptions #(not known property of the Options object)
$SchemaComparison.SettingsService #(not a known property)
How can I do in code what I can EASILY do from the SSDT compare UI?
I found the answer. There is an excludedObjects property hiding in the options object. It's an array of ObjectType enums:
$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::Aggregates
$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::ApplicationRoles
$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::Assemblies
You can exclude any you want. The MSDN includes the list here:
https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.objecttype.aspx