1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Presentation
8 using System.Globalization;
9 using System.Activities.Presentation.Validation;
10 using System.Activities.Validation;
11 using System.Collections.Generic;
13 abstract class DesignTimeValidationFeature : Feature
15 public override void Initialize(EditingContext context, Type modelType)
17 if (modelType != this.ApplyTo)
19 throw FxTrace.Exception.AsError(new InvalidOperationException (
20 string.Format(CultureInfo.CurrentCulture, SR.DesignTimeValidationFeatureOnlyAppliesToType, this.GetType(), this.ApplyTo, modelType)));
23 ValidationService validationService = context.Services.GetService<ValidationService>();
24 if (validationService != null)
26 validationService.Settings.AdditionalConstraints.Add(this.ApplyTo, this.DesignTimeConstraints);
30 protected abstract Type ApplyTo
35 protected abstract IList<Constraint> DesignTimeConstraints