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
- GridViewEditEventArgs.cs
- _Connection.cs
- DataListCommandEventArgs.cs
- BitmapDownload.cs
- CodeDirectoryCompiler.cs
- Sequence.cs
- UInt32Converter.cs
- ComponentDispatcherThread.cs
- ToolboxItemCollection.cs
- ShutDownListener.cs
- AppSecurityManager.cs
- SystemEvents.cs
- EditorZoneBase.cs
- ScaleTransform3D.cs
- TextTreeInsertElementUndoUnit.cs
- Set.cs
- EventLogEntry.cs
- RenderCapability.cs
- SapiGrammar.cs
- OpacityConverter.cs
- DbConnectionOptions.cs
- BasePropertyDescriptor.cs
- BinaryFormatter.cs
- StylusPlugInCollection.cs
- CodeDomDecompiler.cs
- EncoderFallback.cs
- UriScheme.cs
- QilReference.cs
- HostExecutionContextManager.cs
- ProcessHost.cs
- TraceListener.cs
- WindowsEditBox.cs
- LabelExpression.cs
- AccessDataSourceView.cs
- SqlDataSourceStatusEventArgs.cs
- SecurityKeyType.cs
- GroupBoxAutomationPeer.cs
- TransactionFlowElement.cs
- ToolStripTextBox.cs
- Int64AnimationBase.cs
- EnumMemberAttribute.cs
- ByteStreamBufferedMessageData.cs
- UnsafeCollabNativeMethods.cs
- Operand.cs
- IISUnsafeMethods.cs
- NestedContainer.cs
- ResourceManagerWrapper.cs
- SHA1Cng.cs
- KnownBoxes.cs
- DataServiceContext.cs
- SqlClientMetaDataCollectionNames.cs
- InheritablePropertyChangeInfo.cs
- TabControl.cs
- XslTransform.cs
- IndexedGlyphRun.cs
- CompilerInfo.cs
- Group.cs
- FixedSOMSemanticBox.cs
- CodeTypeParameter.cs
- AuthenticationModuleElement.cs
- PublisherIdentityPermission.cs
- DynamicPropertyReader.cs
- UnsafeNativeMethodsPenimc.cs
- BooleanToVisibilityConverter.cs
- DataGridColumnHeader.cs
- DataGridViewAccessibleObject.cs
- Page.cs
- ResourceDisplayNameAttribute.cs
- UIElementIsland.cs
- DbUpdateCommandTree.cs
- OleDbConnectionFactory.cs
- DataViewManagerListItemTypeDescriptor.cs
- BuiltInPermissionSets.cs
- HashAlgorithm.cs
- SystemMulticastIPAddressInformation.cs
- TrackingProfileSerializer.cs
- SqlCachedBuffer.cs
- ProviderMetadata.cs
- SplitterPanelDesigner.cs
- NetStream.cs
- BasePattern.cs
- RedistVersionInfo.cs
- PropertyGroupDescription.cs
- ResourceExpressionEditor.cs
- UniformGrid.cs
- DataRecordObjectView.cs
- Int32KeyFrameCollection.cs
- DataSourceControlBuilder.cs
- LostFocusEventManager.cs
- RegistryExceptionHelper.cs
- validation.cs
- ReadOnlyDataSource.cs
- AttributeCollection.cs
- MessageEncodingBindingElement.cs
- FontEmbeddingManager.cs
- EditorZoneBase.cs
- PageAsyncTaskManager.cs
- XmlSchemaResource.cs
- HttpListenerPrefixCollection.cs
- NamedPipeTransportSecurityElement.cs