Created
February 24, 2011 23:01
-
-
Save zippy1981/843079 to your computer and use it in GitHub Desktop.
Experiments with he newly open sourced Atlantis.SchemaEngine.dll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjust these per your environment | |
[string] $AtlantisSchemaEngineBaseDir = 'F:\src\Atlantis.SchemaEngine\'; | |
[string] $SqlServerInstance = 'localhost\SQLEXPRESS2k8R2'; | |
[string] $dbName = 'master' | |
# This line works: | |
Add-Type -Path "$($AtlantisSchemaEngineBaseDir)\Atlantis.SchemaEngine\bin\Debug\Atlantis.SchemaEngine.dll" | |
[string] $cnStr = "Data Source=$SqlServerInstance;Initial Catalog=$dbName;Integrated Security=SSPI;"; | |
Write-Host "Connection String: $cnStr"; | |
try { | |
$schemaReader = [Atlantis.SchemaEngine.Container.SQLServer.SQLServerSchemaReaderFactory]::GetSpecificSQLServerSchemaReader($cnStr, [Atlantis.SchemaEngine.Enumerations.ContainerMode]::Comparison) | |
$dbObjects = $schemaReader.ReadObjects() | |
Write-Host 'Tables'; | |
$tables = $dbObjects | Where-Object { $_.ObjectSubClass -eq 'Table' } | |
$tables | Select-Object Name, PlainObjectQualifiedName, ReferencingExecutableObjects; | |
Write-Host 'Stored Procedures'; | |
$storedProcs = $dbObjects | Where-Object { $_.ObjectSubClass -eq 'StoredProcedure' } | |
$storedProcs; | |
} | |
catch [Exception] { | |
Write-Host $_.Exception.ToString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment