Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Compiler / Validation / ActivityValidator.cs / 1305376 / ActivityValidator.cs
namespace System.Workflow.ComponentModel.Compiler { using System; using System.Reflection; using System.Workflow.ComponentModel.Design; #region Class ActivityValidator public class ActivityValidator : DependencyObjectValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { if (manager == null) throw new ArgumentNullException("manager"); Activity activity = obj as Activity; if (activity == null) throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(Activity).FullName), "obj"); if (manager.Context == null) throw new ArgumentException("manager", SR.GetString(SR.Error_MissingContextProperty)); manager.Context.Push(activity); ValidationErrorCollection errors = new ValidationErrorCollection(); errors.AddRange(base.Validate(manager, obj)); if (activity.Parent == null) { errors.AddRange(ValidationHelpers.ValidateUniqueIdentifiers(activity)); if (activity.Enabled == false) { ValidationError error = new ValidationError(SR.GetString(SR.Error_RootIsNotEnabled), ErrorNumbers.Error_RootIsNotEnabled); error.PropertyName = "Enabled"; errors.Add(error); } } // validate ID property, only if it is not root activity Activity rootActivity = Helpers.GetRootActivity(activity); if (activity != rootActivity) { ValidationError identifierError = ValidationHelpers.ValidateNameProperty("Name", manager, activity.Name); if (identifierError != null) errors.Add(identifierError); } try { errors.AddRange(ValidateProperties(manager, obj)); } finally { System.Diagnostics.Debug.Assert(manager.Context.Current == activity, "Unwinding contextStack: the item that is about to be popped is not the one we pushed."); manager.Context.Pop(); } return errors; } } #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel.Compiler { using System; using System.Reflection; using System.Workflow.ComponentModel.Design; #region Class ActivityValidator public class ActivityValidator : DependencyObjectValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { if (manager == null) throw new ArgumentNullException("manager"); Activity activity = obj as Activity; if (activity == null) throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(Activity).FullName), "obj"); if (manager.Context == null) throw new ArgumentException("manager", SR.GetString(SR.Error_MissingContextProperty)); manager.Context.Push(activity); ValidationErrorCollection errors = new ValidationErrorCollection(); errors.AddRange(base.Validate(manager, obj)); if (activity.Parent == null) { errors.AddRange(ValidationHelpers.ValidateUniqueIdentifiers(activity)); if (activity.Enabled == false) { ValidationError error = new ValidationError(SR.GetString(SR.Error_RootIsNotEnabled), ErrorNumbers.Error_RootIsNotEnabled); error.PropertyName = "Enabled"; errors.Add(error); } } // validate ID property, only if it is not root activity Activity rootActivity = Helpers.GetRootActivity(activity); if (activity != rootActivity) { ValidationError identifierError = ValidationHelpers.ValidateNameProperty("Name", manager, activity.Name); if (identifierError != null) errors.Add(identifierError); } try { errors.AddRange(ValidateProperties(manager, obj)); } finally { System.Diagnostics.Debug.Assert(manager.Context.Current == activity, "Unwinding contextStack: the item that is about to be popped is not the one we pushed."); manager.Context.Pop(); } return errors; } } #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StoreContentChangedEventArgs.cs
- PasswordPropertyTextAttribute.cs
- WorkflowQueueInfo.cs
- HostProtectionException.cs
- FacetValueContainer.cs
- HttpModuleCollection.cs
- DefaultEventAttribute.cs
- UserNameSecurityTokenAuthenticator.cs
- PlainXmlSerializer.cs
- RegisteredScript.cs
- TemplateColumn.cs
- Instrumentation.cs
- PropertySourceInfo.cs
- RawStylusSystemGestureInputReport.cs
- sitestring.cs
- ListViewItemSelectionChangedEvent.cs
- Header.cs
- ServiceHostingEnvironment.cs
- IPEndPoint.cs
- XsltContext.cs
- DomNameTable.cs
- DataGridComboBoxColumn.cs
- MemberDescriptor.cs
- BitmapEffect.cs
- ByteStreamGeometryContext.cs
- CodeIdentifiers.cs
- ExcCanonicalXml.cs
- FormConverter.cs
- WebPartsPersonalizationAuthorization.cs
- SourceItem.cs
- DeferredBinaryDeserializerExtension.cs
- VectorAnimation.cs
- TextRangeEdit.cs
- EdmScalarPropertyAttribute.cs
- MessagePropertyFilter.cs
- Delegate.cs
- DataGridItem.cs
- ParsedRoute.cs
- XmlSerializerNamespaces.cs
- StringStorage.cs
- FigureParagraph.cs
- _HeaderInfoTable.cs
- _SingleItemRequestCache.cs
- WindowsAuthenticationModule.cs
- MouseActionConverter.cs
- FrameworkElementAutomationPeer.cs
- SessionMode.cs
- ChangePasswordAutoFormat.cs
- UriTemplateHelpers.cs
- uribuilder.cs
- CacheEntry.cs
- DataGridViewIntLinkedList.cs
- sqlpipe.cs
- LinqDataSourceHelper.cs
- XmlChildEnumerator.cs
- Deflater.cs
- LocatorGroup.cs
- TempFiles.cs
- HostingEnvironment.cs
- TextTreeInsertUndoUnit.cs
- Scheduling.cs
- ChtmlImageAdapter.cs
- Int64.cs
- BinaryUtilClasses.cs
- OleDbRowUpdatingEvent.cs
- Run.cs
- SchemaCompiler.cs
- RootAction.cs
- TimeManager.cs
- WorkItem.cs
- ArrayWithOffset.cs
- AmbientLight.cs
- AuthenticationModulesSection.cs
- Function.cs
- WebServiceMethodData.cs
- SafeNativeMethods.cs
- SimpleNameService.cs
- DataMemberListEditor.cs
- QualifiedCellIdBoolean.cs
- MarkupCompiler.cs
- SqlRowUpdatedEvent.cs
- DesignTimeParseData.cs
- ErrorHandlerModule.cs
- DataGridClipboardCellContent.cs
- FrugalList.cs
- ImageAnimator.cs
- LicenseException.cs
- TransactionScope.cs
- Drawing.cs
- SimpleWorkerRequest.cs
- IChannel.cs
- AutomationProperties.cs
- FocusWithinProperty.cs
- Binding.cs
- Psha1DerivedKeyGenerator.cs
- InvokePattern.cs
- LinkUtilities.cs
- ProfilePropertySettings.cs
- UnsafeNativeMethodsPenimc.cs
- InputLanguageSource.cs