Database Reference
In-Depth Information
$version))
if ($passThru) { $asm }
}
function Select-ODPTypes
{
(Get-ODPAssembly).GetTypes() | ? {$_.IsPublic} | sort {$_.
FullName }
}
2. Create a ile Utilities.ps1 for common code often used in conjunction with ODP.
NET. A partial sample from the sample code is as follows:
function Get-ConfigConnectString
{
Param( [Parameter(Mandatory=$true)] [string]$filename,
[Parameter(Mandatory=$true)] [string]$name )
$config = [xml](cat $filename)
$item = $config.configuration.connectionStrings.add | where
{$_.name -eq $name}
if (!$item) { throw "Failed to find a connection string with
name '{0}'" -f $name}
$item.connectionString
}
3. Create an App.config ile with a connection string in the same directory as the
scripts; use the sample included with the code for this recipe or see the recipe
Connecting and disconnecting (Simple) .
4. Create a ile IncludeTest.ps1 to test the included functions. In this ile irst add
the following code to include the common function libraries:
. .\Utilities.ps1
. .\Oracle.DataAccess.ps1
5.
Add some code to list out the functions that were included that have ODP in the
function name:
dir function: | ? {$_.Name -like '*ODP*'} | ft
6.
Load ODP.NET 2x and list types that begin with " OracleCo ":
Load-ODP -version 2
Select-ODPTypes | ? {$_.Name -like 'OracleCo*'} | ft
 
Search WWH ::




Custom Search