次の方法で共有


AsymmetricKeys プロパティ

AsymmetricKey オブジェクトのコレクションを表します。各 AsymmetricKey オブジェクトは、データベースで定義された非対称キーを表します。

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

構文

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

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

プロパティ値

型: Microsoft.SqlServer.Management.Smo. . :: . .AsymmetricKeyCollection
データベースで定義されたすべての非対称キーを表す AsymmetricKeyCollection オブジェクトです。

説明

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

使用例

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 asymmetric keys on the database.
Dim ak As AsymmetricKey
For Each ak In db.AsymmetricKeys
   Console.WriteLine(ak.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 ($ak in $db.AsymmetricKeys)
{
   Write-Host $ak.Name
}