次の方法で共有


Assemblies プロパティ

SqlAssembly オブジェクトのコレクションを表します。各 SqlAssembly オブジェクトは、データベースで定義されたアセンブリを表します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(SqlAssembly))> _
Public ReadOnly Property Assemblies As SqlAssemblyCollection
    Get
'使用
Dim instance As Database
Dim value As SqlAssemblyCollection

value = instance.Assemblies
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(SqlAssembly))]
public SqlAssemblyCollection Assemblies { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(SqlAssembly))]
public:
property SqlAssemblyCollection^ Assemblies {
    SqlAssemblyCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(SqlAssembly))>]
member Assemblies : SqlAssemblyCollection
function get Assemblies () : SqlAssemblyCollection

プロパティ値

型: Microsoft.SqlServer.Management.Smo. . :: . .SqlAssemblyCollection
データベースで定義されたすべてのアセンブリを表す SqlAssemblyCollection オブジェクトです。

説明

アセンブリは、Microsoft .NET 環境での配置単位です。SQL Server で、ストアド プロシージャ、ユーザー定義関数、トリガー、およびユーザー定義データ型の内部でアセンブリを使用するには、事前にそのアセンブリをデータベースに登録する必要があります。SMO では、アセンブリは SqlAssembly オブジェクトによって表現されている場合にデータベースに登録されます。

このコレクションを使用し、アセンブリ名を指定することによって、特定のアセンブリを参照できます。新しいアセンブリをコレクションに追加するには、アセンブリ コンストラクターを呼び出します。

使用例

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server

'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")

'Display all the assemblies on the database.
Dim ar As SqlAssembly
For Each ar In db.Assemblies
   Console.WriteLine(ar.Name)
Next

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
foreach ($ar in $db.Assemblies)
{
   Write-Host $ar.Name
}