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
- ByeMessageApril2005.cs
- PingReply.cs
- ComponentSerializationService.cs
- columnmapkeybuilder.cs
- DigitShape.cs
- CorrelationQueryBehavior.cs
- ReferenceConverter.cs
- SpecialTypeDataContract.cs
- SemanticKeyElement.cs
- StringReader.cs
- ClientSideQueueItem.cs
- MailAddress.cs
- ConfigXmlSignificantWhitespace.cs
- KeyTimeConverter.cs
- AuthenticationException.cs
- EDesignUtil.cs
- DbConnectionFactory.cs
- smtpconnection.cs
- SqlProfileProvider.cs
- BaseProcessor.cs
- SHA256Managed.cs
- UrlUtility.cs
- EventLogHandle.cs
- IdnElement.cs
- DisplayInformation.cs
- DependencyObjectProvider.cs
- WinFormsSecurity.cs
- CommandField.cs
- SoapIncludeAttribute.cs
- ProtocolsConfiguration.cs
- ProgressBar.cs
- _LazyAsyncResult.cs
- Cursors.cs
- DataTableNewRowEvent.cs
- SpecialNameAttribute.cs
- Context.cs
- ServiceModelTimeSpanValidator.cs
- CssStyleCollection.cs
- ListViewEditEventArgs.cs
- TextProviderWrapper.cs
- ParagraphVisual.cs
- DbMetaDataColumnNames.cs
- ConditionValidator.cs
- XsltContext.cs
- ImpersonateTokenRef.cs
- ListViewItem.cs
- FastEncoder.cs
- AesManaged.cs
- Scene3D.cs
- XamlSerializerUtil.cs
- SamlAdvice.cs
- XMLSyntaxException.cs
- DataRowChangeEvent.cs
- Panel.cs
- HierarchicalDataBoundControl.cs
- DataBoundControlHelper.cs
- BlobPersonalizationState.cs
- ConsumerConnectionPoint.cs
- DropShadowEffect.cs
- HotSpot.cs
- Action.cs
- ListView.cs
- TextBreakpoint.cs
- MDIControlStrip.cs
- RegexCompiler.cs
- ProfileService.cs
- DataControlImageButton.cs
- ClientClassGenerator.cs
- _SecureChannel.cs
- SmtpDigestAuthenticationModule.cs
- SqlWebEventProvider.cs
- Visual3DCollection.cs
- CharacterShapingProperties.cs
- EntityContainerEmitter.cs
- IdnElement.cs
- UICuesEvent.cs
- Membership.cs
- GenericRootAutomationPeer.cs
- MulticastOption.cs
- SerializableTypeCodeDomSerializer.cs
- PrivilegeNotHeldException.cs
- TableItemStyle.cs
- QuaternionRotation3D.cs
- PrimarySelectionGlyph.cs
- ReservationNotFoundException.cs
- EmbeddedObject.cs
- DataViewSetting.cs
- NotifyIcon.cs
- SmiRecordBuffer.cs
- TaskFactory.cs
- SqlEnums.cs
- ModelVisual3D.cs
- InOutArgumentConverter.cs
- NonParentingControl.cs
- TextServicesLoader.cs
- DesignerWebPartChrome.cs
- InplaceBitmapMetadataWriter.cs
- List.cs
- ThreadNeutralSemaphore.cs
- ExeConfigurationFileMap.cs