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
- DataSourceView.cs
- ScriptHandlerFactory.cs
- _TimerThread.cs
- AssemblyFilter.cs
- TextSpanModifier.cs
- DataTable.cs
- MD5.cs
- WebAdminConfigurationHelper.cs
- ModelPerspective.cs
- HttpCacheVaryByContentEncodings.cs
- Random.cs
- SmiContextFactory.cs
- CharacterMetrics.cs
- FreezableDefaultValueFactory.cs
- SafePipeHandle.cs
- Timer.cs
- Exceptions.cs
- Pair.cs
- LoadedEvent.cs
- PointHitTestResult.cs
- ScriptManager.cs
- Adorner.cs
- MatrixStack.cs
- TracingConnectionListener.cs
- AstTree.cs
- SchemaTableOptionalColumn.cs
- EditBehavior.cs
- PasswordBox.cs
- TextBoxView.cs
- ProviderSettings.cs
- DecoderReplacementFallback.cs
- SqlBulkCopyColumnMappingCollection.cs
- InputLanguage.cs
- NameGenerator.cs
- ReferenceConverter.cs
- FontStretchConverter.cs
- InternalException.cs
- SystemInformation.cs
- WebPartConnectionsCancelVerb.cs
- NavigationExpr.cs
- SQLInt16Storage.cs
- RegexGroup.cs
- DataGridItemEventArgs.cs
- Pair.cs
- SizeLimitedCache.cs
- SortKey.cs
- InfoCardSchemas.cs
- PolyLineSegmentFigureLogic.cs
- XmlDocumentFragment.cs
- ViewStateChangedEventArgs.cs
- OperationAbortedException.cs
- DiscoveryDocument.cs
- ContextActivityUtils.cs
- CodeAttachEventStatement.cs
- QilInvokeEarlyBound.cs
- DBSqlParserTableCollection.cs
- StringAnimationUsingKeyFrames.cs
- DefaultValueAttribute.cs
- COSERVERINFO.cs
- MetadataCache.cs
- BrowserDefinition.cs
- WorkflowShape.cs
- ArrangedElementCollection.cs
- IsolatedStorageFile.cs
- XmlSchemaRedefine.cs
- CompoundFileReference.cs
- MDIClient.cs
- XmlNodeReader.cs
- StorageModelBuildProvider.cs
- EmissiveMaterial.cs
- XmlSchemaException.cs
- NullRuntimeConfig.cs
- HttpProfileGroupBase.cs
- DataBindingHandlerAttribute.cs
- WebPartMinimizeVerb.cs
- KeySpline.cs
- DesignerAttributeInfo.cs
- LogEntryHeaderDeserializer.cs
- LinqTreeNodeEvaluator.cs
- SimpleTextLine.cs
- ExpressionStringBuilder.cs
- ImmutableObjectAttribute.cs
- CreateDataSourceDialog.cs
- _UriTypeConverter.cs
- BitSet.cs
- TypeExtension.cs
- QuestionEventArgs.cs
- StoryFragments.cs
- AncestorChangedEventArgs.cs
- CompiledRegexRunner.cs
- TabControlAutomationPeer.cs
- SessionStateUtil.cs
- LabelDesigner.cs
- InternalCache.cs
- CodeSnippetExpression.cs
- DetailsViewInsertedEventArgs.cs
- UxThemeWrapper.cs
- PrintPageEvent.cs
- ExpandCollapseProviderWrapper.cs
- ItemsPanelTemplate.cs