2 // Copyright (c) Microsoft Corporation. All rights reserved.
5 namespace System.Activities.Presentation.Validation
7 using System.Activities.Validation;
9 using System.ServiceModel.Activities;
11 internal sealed class ValidationRoot
13 private WorkflowService workflowService;
14 private Activity activity;
16 public ValidationRoot(WorkflowService workflowService)
18 Fx.Assert(workflowService != null, "workflowService != null");
19 this.workflowService = workflowService;
22 public ValidationRoot(Activity activity)
24 Fx.Assert(activity != null, "activity!=null");
25 this.activity = activity;
28 public ValidationResults Validate(ValidationSettings settings)
30 if (this.workflowService != null)
32 return this.workflowService.Validate(settings);
36 return ActivityValidationServices.Validate(this.activity, settings);
40 public Activity Resolve(string id)
42 Fx.Assert(id != null, "id should not be null.");
44 Activity activityRoot = null;
45 if (this.workflowService != null)
47 activityRoot = this.workflowService.GetWorkflowRoot();
51 activityRoot = this.activity;
54 return ActivityValidationServices.Resolve(activityRoot, id);