Database.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 AdventureWorks2012 database.
Dim db As Database
db = srv.Databases("AdventureWorks2012")

'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("AdventureWorks2012")
foreach ($ar in $db.Assemblies)
{
   Write-Host $ar.Name
}

関連項目

参照

Database クラス

Microsoft.SqlServer.Management.Smo 名前空間

その他の技術情報

データベース オブジェクトでの作業

CREATE ASSEMBLY (Transact-SQL)

データベースの作成、変更、および削除

CREATE DATABASE (Transact-SQL)