Aracılığıyla paylaş


Server.Roles Özelliği

Temsil eden bir koleksiyon , ServerRole nesneler.Her ServerRole nesnesini gösteren örnek üzerinde tanımlı bir rol SQL Server.

Ad Alanı:  Microsoft.SqlServer.Management.Smo
Derleme:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo içinde.dll)

Sözdizimi

'Bildirim
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(ServerRole))> _
Public ReadOnly Property Roles As ServerRoleCollection
    Get
'Kullanım
Dim instance As Server
Dim value As ServerRoleCollection

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

Özellik Değeri

Tür: Microsoft.SqlServer.Management.Smo.ServerRoleCollection
A ServerRoleCollection tanımlanan rolleri temsil eden nesne örnek , SQL Server.

Açıklamalar

Roles özellik gösterdiği için ServerRoleCollection nesne.Koleksiyon örnek sabit sunucu rolleri başvurmak için kullanabilirsiniz SQL Server.

Örnekler

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Display the fixed server roles.
Dim sr As ServerRole
For Each sr In srv.Roles
   Console.WriteLine(sr.Name)
Next

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
foreach ($sr in $srv.Roles)
{
   Write-Host $sr.Name
}