Share via


Policy Constructor (PolicyStore, String)

Initializes a new instance of the Policy class.

Namespace:  Microsoft.SqlServer.Management.Dmf
Assembly:  Microsoft.SqlServer.Dmf (in Microsoft.SqlServer.Dmf.dll)

Syntax

'Declaration
Public Sub New ( _
    parent As PolicyStore, _
    name As String _
)
'Usage
Dim parent As PolicyStore
Dim name As String

Dim instance As New Policy(parent, _
    name)
public Policy(
    PolicyStore parent,
    string name
)
public:
Policy(
    PolicyStore^ parent, 
    String^ name
)
new : 
        parent:PolicyStore * 
        name:string -> Policy
public function Policy(
    parent : PolicyStore, 
    name : String
)

Parameters

Examples

C#

Policy p = new Policy(ps, policyName);
p.AutomatedPolicyEvaluationMode = execMode;
p.Condition = condition.Name;
p.ScheduleUid = schedule.ScheduleUid;
if (execMode != AutomatedPolicyEvaluationMode.None) p.Enabled = true;
p.Create();