Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
As an alternative to implementing the IPolicyDefinition and IPolicyEvaluation interfaces, derive a class from PolicyBase.
Example
class SimplePolicy : PolicyBase
{
public override PolicyFailure[] Evaluate()
{
return new PolicyFailure[] {
new PolicyFailure("This Check-in Policy succeeded.", this),
new PolicyFailure("This Check-in Policy succeeded also.", this),
new MyPolicyFailure("This Check-in Policy failed.", this),
new MyPolicyFailure("This Check-in Policy failed also.", this),
new PolicyFailure("This Check-in Policy also succeeded.", this),
};
}
public override bool CanEdit { get { return false; } }
public override bool Edit(IPolicyEditArgs policyEditArgs)
{
// If a UI for this check-in policy exists, it can be invoked here
return false;
}
public override string Description { get { return "Description of the policy"; } }
public override string Type { get { return "Policy type text"; } }
public override string TypeDescription { get { return "Description of the policy type"; } }
}