Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ClientSettingsProvider.cs
- HtmlTableCellCollection.cs
- RadioButtonStandardAdapter.cs
- IPCCacheManager.cs
- loginstatus.cs
- ExpressionPrinter.cs
- UriTemplateVariablePathSegment.cs
- _HeaderInfo.cs
- Metadata.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- DirectionalLight.cs
- ResourcesChangeInfo.cs
- VectorAnimationUsingKeyFrames.cs
- ComponentEditorForm.cs
- WebException.cs
- CapabilitiesPattern.cs
- GlyphsSerializer.cs
- XmlElement.cs
- DataGridViewHeaderCell.cs
- ExpandableObjectConverter.cs
- DataGridLengthConverter.cs
- Dump.cs
- MetadataUtilsSmi.cs
- FirstMatchCodeGroup.cs
- RegisteredArrayDeclaration.cs
- AutoResetEvent.cs
- QuaternionRotation3D.cs
- PackWebRequest.cs
- WorkflowMarkupSerializerMapping.cs
- ZipIOBlockManager.cs
- ExceptionTrace.cs
- PanelStyle.cs
- VisualTreeHelper.cs
- OleDbParameterCollection.cs
- XmlSchemaNotation.cs
- DbDataReader.cs
- StyleBamlRecordReader.cs
- AtomServiceDocumentSerializer.cs
- DataGridViewColumnStateChangedEventArgs.cs
- GlyphTypeface.cs
- ImageSource.cs
- EventProviderWriter.cs
- IdentifierService.cs
- ExceptionHelpers.cs
- GridProviderWrapper.cs
- TranslateTransform3D.cs
- PageThemeBuildProvider.cs
- Italic.cs
- GridEntry.cs
- DecoratedNameAttribute.cs
- DataBinder.cs
- BinaryUtilClasses.cs
- Operand.cs
- Int32.cs
- UriSectionData.cs
- MailDefinition.cs
- RemoveStoryboard.cs
- Image.cs
- ManageRequest.cs
- WindowsEditBox.cs
- LinearGradientBrush.cs
- PlainXmlDeserializer.cs
- PageVisual.cs
- MemberJoinTreeNode.cs
- XmlWhitespace.cs
- ExceptionHandler.cs
- ComPlusTypeLoader.cs
- SignedInfo.cs
- InheritanceContextHelper.cs
- ParseHttpDate.cs
- LifetimeServices.cs
- DetailsViewRow.cs
- Expander.cs
- ListViewItemCollectionEditor.cs
- COM2Properties.cs
- DateRangeEvent.cs
- RangeBaseAutomationPeer.cs
- ScriptControlDescriptor.cs
- ColorConvertedBitmap.cs
- DuplicateDetector.cs
- SqlDataReaderSmi.cs
- Stopwatch.cs
- TimeSpanConverter.cs
- _PooledStream.cs
- ServiceChannelManager.cs
- SerialStream.cs
- PathFigureCollection.cs
- BasicDesignerLoader.cs
- RegexMatch.cs
- SoapIgnoreAttribute.cs
- SqlCommandBuilder.cs
- IxmlLineInfo.cs
- StorageMappingItemCollection.cs
- EnumValAlphaComparer.cs
- HtmlInputButton.cs
- GuidConverter.cs
- ObjectDataSourceSelectingEventArgs.cs
- ProxyManager.cs
- UniqueContractNameValidationBehavior.cs
- XsltException.cs