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
- XmlILTrace.cs
- InputScopeConverter.cs
- ClientTargetCollection.cs
- FunctionMappingTranslator.cs
- AddInDeploymentState.cs
- ContentPlaceHolderDesigner.cs
- StatusBarDrawItemEvent.cs
- ValidatedControlConverter.cs
- JpegBitmapEncoder.cs
- SqlNamer.cs
- EdgeModeValidation.cs
- StringValueSerializer.cs
- NumberFunctions.cs
- SymDocumentType.cs
- QueryException.cs
- PointLightBase.cs
- SpellerHighlightLayer.cs
- Baml2006KeyRecord.cs
- XamlDesignerSerializationManager.cs
- DecoratedNameAttribute.cs
- PerformanceCounterManager.cs
- MetadataItemEmitter.cs
- XmlSecureResolver.cs
- MinMaxParagraphWidth.cs
- Tool.cs
- PropertyChange.cs
- System.Data.OracleClient_BID.cs
- PeerCollaboration.cs
- CellPartitioner.cs
- NavigationWindowAutomationPeer.cs
- FileDialogPermission.cs
- Privilege.cs
- ConfigXmlWhitespace.cs
- AttachedPropertyMethodSelector.cs
- TableLayoutPanelResizeGlyph.cs
- UserControl.cs
- SettingsAttributeDictionary.cs
- SqlDataSourceConfigureSelectPanel.cs
- SchemaInfo.cs
- ToolStripDropDown.cs
- XmlSerializerAssemblyAttribute.cs
- QueryOptionExpression.cs
- BlobPersonalizationState.cs
- TextPattern.cs
- XmlTextReader.cs
- TableLayoutColumnStyleCollection.cs
- SecureUICommand.cs
- HtmlAnchor.cs
- WebPartManagerInternals.cs
- IISMapPath.cs
- OlePropertyStructs.cs
- DataObjectAttribute.cs
- RemoteWebConfigurationHostStream.cs
- DataGridColumnHeadersPresenter.cs
- BufferedGraphicsManager.cs
- safelink.cs
- DiscoveryClientChannelBase.cs
- ActiveDocumentEvent.cs
- InvokeMethodActivity.cs
- SafeCryptoHandles.cs
- InitializationEventAttribute.cs
- InstalledVoice.cs
- Content.cs
- BasicViewGenerator.cs
- Renderer.cs
- DecimalKeyFrameCollection.cs
- TrackingMemoryStreamFactory.cs
- querybuilder.cs
- ToolStripTextBox.cs
- TransformCollection.cs
- WindowsListViewSubItem.cs
- MemberListBinding.cs
- TextureBrush.cs
- _OverlappedAsyncResult.cs
- bidPrivateBase.cs
- CheckBoxField.cs
- DoubleAverageAggregationOperator.cs
- X500Name.cs
- DictionaryBase.cs
- arc.cs
- NullReferenceException.cs
- TypeHelper.cs
- ImagingCache.cs
- DecimalStorage.cs
- ObjectParameterCollection.cs
- Compress.cs
- DescriptionAttribute.cs
- input.cs
- SuppressMergeCheckAttribute.cs
- DoubleCollectionConverter.cs
- CommandEventArgs.cs
- CommonEndpointBehaviorElement.cs
- FlowDocumentReader.cs
- SplitterPanel.cs
- _OSSOCK.cs
- ViewGenerator.cs
- HtmlPageAdapter.cs
- HtmlTable.cs
- PerspectiveCamera.cs
- WebControlsSection.cs