Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / ToRequest.cs / 1407647 / ToRequest.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Activities { using System.Activities; using System.Collections.ObjectModel; using System.Runtime; using System.ServiceModel.Channels; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; class ToRequest : CodeActivity { MessageVersion messageVersion; Collectionparameters; public ToRequest() { } public Send Send { get; set; } public IClientMessageFormatter Formatter { get; set; } public Collection Parameters { get { if (this.parameters == null) { this.parameters = new Collection (); } return this.parameters; } } public OutArgument Message { get; set; } internal MessageVersion MessageVersion { get { if (this.messageVersion == null) { this.messageVersion = this.Send.GetMessageVersion(); } return this.messageVersion; } } protected override void CacheMetadata(CodeActivityMetadata metadata) { if (this.parameters != null) { int count = 0; foreach (InArgument parameter in this.parameters) { RuntimeArgument parameterArgument = new RuntimeArgument(Constants.Parameter + count++, parameter.ArgumentType, ArgumentDirection.In); metadata.Bind(parameter, parameterArgument); metadata.AddArgument(parameterArgument); } } RuntimeArgument messageArgument = new RuntimeArgument(Constants.Message, Constants.MessageType, ArgumentDirection.Out, true); metadata.Bind(this.Message, messageArgument); metadata.AddArgument(messageArgument); Fx.Assert(this.Send != null, "Send cannot be null"); } protected override void Execute(CodeActivityContext context) { object[] inObjects; if (this.parameters == null || this.parameters.Count == 0) { inObjects = Constants.EmptyArray; } else { inObjects = new object[this.parameters.Count]; for (int i = 0; i < this.parameters.Count; i++) { Fx.Assert(this.parameters[i] != null, "Parameter should not be null"); inObjects[i] = this.parameters[i].Get(context); } } // Formatter is cached since it is fixed for each definition of Send if (this.Formatter == null) { OperationDescription operation = ContractInferenceHelper.CreateOneWayOperationDescription(this.Send); this.Formatter = ClientOperationFormatterProvider.GetFormatterFromRuntime(operation); this.Send.OperationDescription = operation; } // Send.ChannelCacheEnabled must be set before we call this.MessageVersion // because this.MessageVersion will cache description and description resolution depends on the value of ChannelCacheEnabled this.Send.InitializeChannelCacheEnabledSetting(context); // MessageVersion is cached for perf reasons since it is fixed for each definition of Send Message outMessage = this.Formatter.SerializeRequest(this.MessageVersion, inObjects); this.Message.Set(context, outMessage); } } } // 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
- SafeFileMappingHandle.cs
- mda.cs
- ISCIIEncoding.cs
- XmlBinaryReaderSession.cs
- XPathBinder.cs
- HandleCollector.cs
- CachedPathData.cs
- AnnotationService.cs
- RenderCapability.cs
- IItemProperties.cs
- ToolStripSeparatorRenderEventArgs.cs
- IsolatedStorage.cs
- OutArgument.cs
- ZipIOExtraFieldElement.cs
- SoapIncludeAttribute.cs
- MarkerProperties.cs
- WorkflowEventArgs.cs
- SimpleHandlerBuildProvider.cs
- DoubleUtil.cs
- SecurityPolicySection.cs
- StrokeCollectionDefaultValueFactory.cs
- CompilerScope.cs
- PageSetupDialog.cs
- XamlFilter.cs
- PageWrapper.cs
- FamilyMapCollection.cs
- ConstraintStruct.cs
- XmlSchemaSimpleTypeUnion.cs
- DataGridViewRowPostPaintEventArgs.cs
- AudienceUriMode.cs
- FolderNameEditor.cs
- PropertyPathWorker.cs
- WhiteSpaceTrimStringConverter.cs
- VectorCollectionConverter.cs
- DocumentViewerConstants.cs
- PrivacyNoticeBindingElementImporter.cs
- WeakReference.cs
- FileRecordSequence.cs
- LineBreak.cs
- ReadContentAsBinaryHelper.cs
- XamlTreeBuilderBamlRecordWriter.cs
- AsymmetricCryptoHandle.cs
- Walker.cs
- MemberHolder.cs
- AttributeCollection.cs
- StoryFragments.cs
- DataGridViewRowsAddedEventArgs.cs
- SafeHandles.cs
- BaseResourcesBuildProvider.cs
- RowUpdatedEventArgs.cs
- CheckedPointers.cs
- VisualState.cs
- DateBoldEvent.cs
- HtmlElementEventArgs.cs
- VirtualPathProvider.cs
- XmlWriterSettings.cs
- EventHandlerList.cs
- PrintPreviewGraphics.cs
- StrokeRenderer.cs
- DeploymentExceptionMapper.cs
- securitycriticaldata.cs
- StorageEntitySetMapping.cs
- HashAlgorithm.cs
- DBBindings.cs
- ExpressionEditorAttribute.cs
- SerializationObjectManager.cs
- RenderTargetBitmap.cs
- FileDialogPermission.cs
- SqlExpressionNullability.cs
- _DisconnectOverlappedAsyncResult.cs
- Publisher.cs
- HostedTcpTransportManager.cs
- TextInfo.cs
- LZCodec.cs
- dataobject.cs
- Quaternion.cs
- MessagePartSpecification.cs
- IdleTimeoutMonitor.cs
- TextEditorThreadLocalStore.cs
- DataGridTextBoxColumn.cs
- SourceFilter.cs
- Win32MouseDevice.cs
- OracleConnectionString.cs
- InputBinding.cs
- EqualityComparer.cs
- PhysicalAddress.cs
- RegexGroupCollection.cs
- XmlAnyAttributeAttribute.cs
- ConditionCollection.cs
- UmAlQuraCalendar.cs
- DecimalConstantAttribute.cs
- TraceData.cs
- XDeferredAxisSource.cs
- DBSchemaRow.cs
- CorrelationResolver.cs
- IisTraceListener.cs
- RemotingServices.cs
- FacetValueContainer.cs
- ProxySimple.cs
- EventListenerClientSide.cs