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)

public Policy(
	PolicyStore parent,
	string name
)

Parameters

parent
Type: Microsoft.SqlServer.Management.Dmf.PolicyStore

A PolicyStore object value that specifies the policy store to which the policy belongs.

name
Type: System.String

A String value that specifies the name of the policy.

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();
Return to top
Show: