Compartir a través de


AffinityType Propiedad

Gets or Sets the AffinityType()()()() member of the AffinityInfo class. Valid values are Auto or Manual.

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
Public Property AffinityType As AffinityType
    Get
    Set
'Uso
Dim instance As AffinityInfo
Dim value As AffinityType

value = instance.AffinityType

instance.AffinityType = value
public AffinityType AffinityType { get; set; }
public:
property AffinityType AffinityType {
    AffinityType get ();
    void set (AffinityType value);
}
member AffinityType : AffinityType with get, set
function get AffinityType () : AffinityType
function set AffinityType (value : AffinityType)

Valor de la propiedad

Tipo: Microsoft.SqlServer.Management.Smo. . :: . .AffinityType
The current value of the AffinityType()()()() member.

Comentarios

Changes are not applied to the Instance of SQL Server until Alter or Server()()()() method is called.

To set any AffinityInfo object properties and run the Alter method, users must have ALTER permission on the database.

Ejemplos

This example shows you how to display the local instance of SQL Server's AffinityType()()()() setting and then change that setting to the Auto Affinity type.

using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Server dbServer = new Server("(local)");

            //Retrieve the servers AffinityInfo settings and
            //display the current AffinityType setting.
            dbServer.Refresh();
            Console.WriteLine(dbServer.AffinityInfo.AffinityType);

            //Change the AffinityType setting to Auto and
            //update the server with the new setting.
            dbServer.AffinityInfo.AffinityType = AffinityType.Auto;
            dbServer.AffinityInfo.Alter();
        }
    }
}

Powershell

#Create the server. 
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")

#Retrieve the servers AffinityInfo settings and
#display the current AffinityType setting.
$dbServer.Refresh()
Write-Host $dbServer.AffinityInfo.AffinityType

#Change the AffinityType setting to Auto and
#update the server with the new setting.
$dbServer.AffinityInfo.AffinityType =  [Microsoft.SqlServer.Management.Smo.AffinityType]'Auto'
$dbServer.AffinityInfo.Alter()