Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / Workflow / Activities / ReceiveActivityValidator.cs / 1305376 / ReceiveActivityValidator.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.Workflow.Activities
{
using System.ServiceModel;
using System.Reflection;
using System.Collections.Generic;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
class ReceiveActivityValidator : CompositeActivityValidator
{
public override ValidationErrorCollection Validate(
ValidationManager manager,
object obj)
{
ValidationErrorCollection validationErrors = base.Validate(manager, obj);
ReceiveActivity receiveActivity = obj as ReceiveActivity;
if (receiveActivity == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("obj",
SR2.GetString(SR2.Error_ArgumentTypeInvalid, "obj", typeof(ReceiveActivity)));
}
ITypeProvider typeProvider = manager.GetService(typeof(ITypeProvider)) as ITypeProvider;
if (typeProvider == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
SR2.GetString(SR2.General_MissingService, typeof(ITypeProvider).Name)));
}
if (receiveActivity.ServiceOperationInfo == null)
{
validationErrors.Add(
new ValidationError(
SR2.GetString(SR2.Error_Validation_OperationInfoNotSpecified, receiveActivity.Name),
WorkflowServicesErrorNumbers.Error_OperationInfoNotSpecified,
false,
"ServiceOperationInfo"));
}
else
{
// validate operation info
//
ValidationErrorCollection operationInfoValidationErrors =
ValidationHelper.ValidateOperationInfo(
receiveActivity,
receiveActivity.ServiceOperationInfo,
manager);
validationErrors.AddRange(operationInfoValidationErrors);
// do not validate parameter binding if the operation info is not valid
// we might generate noise and false positives.
//
if (operationInfoValidationErrors.Count == 0)
{
validationErrors.AddRange(
ValidationHelper.ValidateParameterBindings(receiveActivity, receiveActivity.ServiceOperationInfo,
receiveActivity.ParameterBindings, manager));
}
// validate the context token
//
validationErrors.AddRange(
ValidationHelper.ValidateContextToken(receiveActivity, receiveActivity.ContextToken, manager));
}
// Check if the validation for all service operations being implemented
// has been done previously.
// If it has been done once then ServiceOperationsImplementedValidationMarker
// will be on the context stack.
//
if (validationErrors.Count == 0 &&
manager.Context[typeof(ServiceOperationsImplementedValidationMarker)] == null)
{
Activity rootActivity = receiveActivity;
while (rootActivity.Parent != null)
{
rootActivity = rootActivity.Parent;
}
validationErrors.AddRange(
ValidationHelper.ValidateAllServiceOperationsImplemented(
manager,
rootActivity));
}
return validationErrors;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OptimizedTemplateContentHelper.cs
- TemplateInstanceAttribute.cs
- DataGridViewCheckBoxCell.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- CapabilitiesUse.cs
- InputMethodStateChangeEventArgs.cs
- SymbolPair.cs
- WindowsGraphics2.cs
- VisualStateChangedEventArgs.cs
- XmlSchemaException.cs
- PrintingPermission.cs
- DataBindingList.cs
- UnicodeEncoding.cs
- Main.cs
- Brush.cs
- FormatterServices.cs
- LOSFormatter.cs
- FieldAccessException.cs
- MsmqChannelFactory.cs
- TcpProcessProtocolHandler.cs
- TogglePatternIdentifiers.cs
- DataListItemEventArgs.cs
- ObservableDictionary.cs
- ProviderConnectionPointCollection.cs
- Missing.cs
- Activator.cs
- ObjectQueryExecutionPlan.cs
- SmiSettersStream.cs
- TextRunCacheImp.cs
- ColumnTypeConverter.cs
- ViewSimplifier.cs
- TagPrefixCollection.cs
- Matrix3DStack.cs
- Registry.cs
- ListDictionaryInternal.cs
- IQueryable.cs
- NativeMethodsCLR.cs
- PrimitiveXmlSerializers.cs
- FlowDocument.cs
- DBDataPermission.cs
- AppDomain.cs
- MenuItemCollection.cs
- OverflowException.cs
- HttpFileCollection.cs
- BinaryReader.cs
- ArrayMergeHelper.cs
- RelationshipDetailsRow.cs
- SessionSwitchEventArgs.cs
- SchemaImporter.cs
- LambdaCompiler.Generated.cs
- PathSegmentCollection.cs
- StaticExtension.cs
- OperandQuery.cs
- ControlBuilder.cs
- EntityDataSourceMemberPath.cs
- XmlLinkedNode.cs
- CapabilitiesAssignment.cs
- NestPullup.cs
- DbDataReader.cs
- DbConnectionPoolGroupProviderInfo.cs
- RtType.cs
- StreamSecurityUpgradeAcceptorBase.cs
- TypeBuilderInstantiation.cs
- RtfControls.cs
- Nullable.cs
- FilterableAttribute.cs
- XmlSchemaFacet.cs
- BinaryVersion.cs
- SchemaTableOptionalColumn.cs
- FunctionParameter.cs
- ArgIterator.cs
- mediaeventshelper.cs
- BooleanToVisibilityConverter.cs
- QilName.cs
- EpmCustomContentWriterNodeData.cs
- StylusTip.cs
- FieldBuilder.cs
- XamlRtfConverter.cs
- Label.cs
- TransactionOptions.cs
- SerializerProvider.cs
- XPathScanner.cs
- TextUtf8RawTextWriter.cs
- SQLMoney.cs
- FaultHandlingFilter.cs
- LocalizableAttribute.cs
- MimeMultiPart.cs
- SessionStateModule.cs
- CodeConstructor.cs
- RecipientInfo.cs
- StreamMarshaler.cs
- TextChangedEventArgs.cs
- UserControl.cs
- UrlPath.cs
- PeerOutputChannel.cs
- Application.cs
- TableParagraph.cs
- __TransparentProxy.cs
- WorkflowOwnershipException.cs
- AddressHeaderCollection.cs