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
- WebHttpSecurityElement.cs
- MultiViewDesigner.cs
- SystemIPInterfaceProperties.cs
- HighContrastHelper.cs
- RayMeshGeometry3DHitTestResult.cs
- BlobPersonalizationState.cs
- WebCategoryAttribute.cs
- COM2ColorConverter.cs
- SmtpReplyReaderFactory.cs
- NativeRightsManagementAPIsStructures.cs
- XNodeValidator.cs
- RenderContext.cs
- RouteData.cs
- ModifiableIteratorCollection.cs
- GB18030Encoding.cs
- UInt64Storage.cs
- ProfileSettings.cs
- FragmentNavigationEventArgs.cs
- DesignerLoader.cs
- InstanceCreationEditor.cs
- SessionIDManager.cs
- ScrollPattern.cs
- TreeNodeConverter.cs
- SamlAudienceRestrictionCondition.cs
- SqlTriggerContext.cs
- RijndaelManaged.cs
- ConfigsHelper.cs
- StaticExtensionConverter.cs
- XPathSelfQuery.cs
- PackageRelationshipSelector.cs
- MappingMetadataHelper.cs
- MemberAccessException.cs
- SerializationInfoEnumerator.cs
- XmlEncodedRawTextWriter.cs
- COMException.cs
- GenericIdentity.cs
- PrefixHandle.cs
- XamlSerializerUtil.cs
- SingleTagSectionHandler.cs
- DataPagerFieldCommandEventArgs.cs
- FixedPageProcessor.cs
- StringSource.cs
- ComplexTypeEmitter.cs
- ParentControlDesigner.cs
- XNodeNavigator.cs
- QuadraticBezierSegment.cs
- FrameworkObject.cs
- CoordinationService.cs
- AddressUtility.cs
- ExpressionEditorSheet.cs
- MsmqHostedTransportConfiguration.cs
- WebBrowser.cs
- FontWeight.cs
- SingleSelectRootGridEntry.cs
- DescendantQuery.cs
- ListViewSortEventArgs.cs
- TextViewBase.cs
- DBSqlParserColumnCollection.cs
- MediaEntryAttribute.cs
- _ProxyRegBlob.cs
- AuditLogLocation.cs
- DesignerVerbCollection.cs
- BinaryObjectWriter.cs
- ColorBlend.cs
- DataGridRelationshipRow.cs
- DocumentSequence.cs
- DataRecord.cs
- brushes.cs
- ObjectViewQueryResultData.cs
- DiscoveryOperationContext.cs
- TextSelectionProcessor.cs
- UserUseLicenseDictionaryLoader.cs
- LayoutEvent.cs
- PropertyGridCommands.cs
- UserNameSecurityToken.cs
- DateTimeValueSerializerContext.cs
- CheckBox.cs
- SourceItem.cs
- ComponentResourceKey.cs
- BorderSidesEditor.cs
- SqlSelectClauseBuilder.cs
- ConnectionStringsSection.cs
- QueueSurrogate.cs
- ContextInformation.cs
- DocumentXmlWriter.cs
- GridViewRowPresenterBase.cs
- TagPrefixInfo.cs
- AttachedAnnotationChangedEventArgs.cs
- SmtpMail.cs
- CreateParams.cs
- RowCache.cs
- SingleStorage.cs
- CodeAssignStatement.cs
- DbParameterHelper.cs
- XmlValidatingReader.cs
- DefaultDialogButtons.cs
- Expander.cs
- UInt16.cs
- RepeaterItemCollection.cs
- CheckBoxRenderer.cs