Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / TransportOutputChannel.cs / 1 / TransportOutputChannel.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; using System.ServiceModel; using System.Diagnostics; using System.Xml; abstract class TransportOutputChannel : OutputChannel { bool anyHeadersToAdd; bool manualAddressing; MessageVersion messageVersion; EndpointAddress to; Uri via; ToHeader toHeader; protected TransportOutputChannel(ChannelManagerBase channelManager, EndpointAddress to, Uri via, bool manualAddressing, MessageVersion messageVersion) : base(channelManager) { this.manualAddressing = manualAddressing; this.messageVersion = messageVersion; this.to = to; this.via = via; if (!manualAddressing && to != null) { Uri toUri; if (to.IsAnonymous) { toUri = this.messageVersion.Addressing.AnonymousUri; } else if (to.IsNone) { toUri = this.messageVersion.Addressing.NoneUri; } else { toUri = to.Uri; } XmlDictionaryString dictionaryTo = new ToDictionary(toUri.AbsoluteUri).To; this.toHeader = ToHeader.Create(toUri, dictionaryTo, messageVersion.Addressing); this.anyHeadersToAdd = to.Headers.Count > 0; } } protected bool ManualAddressing { get { return this.manualAddressing; } } public MessageVersion MessageVersion { get { return this.messageVersion; } } public override EndpointAddress RemoteAddress { get { return this.to; } } public override Uri Via { get { return this.via; } } protected override void AddHeadersTo(Message message) { base.AddHeadersTo(message); if (toHeader != null) { // we don't use to.ApplyTo(message) since it's faster to cache and // use the actualheader then to call message.Headers.To = Uri... message.Headers.SetToHeader(toHeader); if (anyHeadersToAdd) { to.Headers.AddHeadersTo(message); } } } class ToDictionary : IXmlDictionary { XmlDictionaryString to; public ToDictionary(string to) { this.to = new XmlDictionaryString(this, to, 0); } public XmlDictionaryString To { get { return to; } } public bool TryLookup(string value, out XmlDictionaryString result) { if (value == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); if (value == to.Value) { result = to; return true; } result = null; return false; } public bool TryLookup(int key, out XmlDictionaryString result) { if (key == 0) { result = to; return true; } result = null; return false; } public bool TryLookup(XmlDictionaryString value, out XmlDictionaryString result) { if (value == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); if (value == to) { result = to; return true; } result = null; return false; } } } } // 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
- DoneReceivingAsyncResult.cs
- ParameterModifier.cs
- BinaryFormatterWriter.cs
- GroupBox.cs
- StringBuilder.cs
- altserialization.cs
- SQLInt32Storage.cs
- ProfileModule.cs
- CharAnimationBase.cs
- HttpPostLocalhostServerProtocol.cs
- PassportAuthentication.cs
- XsdDuration.cs
- NotSupportedException.cs
- ArgumentNullException.cs
- QueuePropertyVariants.cs
- HMACMD5.cs
- TextOptions.cs
- EvidenceBase.cs
- TextTreeFixupNode.cs
- RawStylusInputReport.cs
- HtmlToClrEventProxy.cs
- DocumentEventArgs.cs
- TableAutomationPeer.cs
- sqlmetadatafactory.cs
- DockEditor.cs
- AspNetSynchronizationContext.cs
- ApplicationTrust.cs
- DiscoveryInnerClientAdhocCD1.cs
- Style.cs
- AncestorChangedEventArgs.cs
- OdbcConnectionOpen.cs
- EditorPartCollection.cs
- ProtocolProfile.cs
- BaseInfoTable.cs
- __Filters.cs
- HtmlPageAdapter.cs
- CodeDomSerializer.cs
- SmiMetaData.cs
- CodeIndexerExpression.cs
- PenThreadWorker.cs
- DocumentPaginator.cs
- InvalidAsynchronousStateException.cs
- SQLInt32.cs
- DataGridViewImageCell.cs
- ListItemCollection.cs
- RegisterInfo.cs
- DictionaryKeyPropertyAttribute.cs
- DefaultBinder.cs
- ChtmlSelectionListAdapter.cs
- CodeDefaultValueExpression.cs
- CharAnimationUsingKeyFrames.cs
- DbConnectionClosed.cs
- SchemaElementLookUpTable.cs
- ScrollBar.cs
- OleDbEnumerator.cs
- GAC.cs
- ConcurrencyBehavior.cs
- TextLineResult.cs
- FramingChannels.cs
- SqlInternalConnectionSmi.cs
- SelectionItemProviderWrapper.cs
- FixedSOMFixedBlock.cs
- WebControlAdapter.cs
- JsonUriDataContract.cs
- DispatcherHooks.cs
- PipelineModuleStepContainer.cs
- LinkLabel.cs
- ControlPaint.cs
- FocusTracker.cs
- ExpressionBuilder.cs
- WindowProviderWrapper.cs
- PropertyGrid.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DrawingImage.cs
- TextureBrush.cs
- WorkflowRuntimeServiceElement.cs
- MatrixTransform3D.cs
- IndexerNameAttribute.cs
- ADMembershipProvider.cs
- EventWaitHandleSecurity.cs
- PartBasedPackageProperties.cs
- MemoryFailPoint.cs
- SelectionListComponentEditor.cs
- XmlTextReader.cs
- SafeBitVector32.cs
- ThreadStaticAttribute.cs
- DynamicPropertyReader.cs
- SafeNativeMethods.cs
- Soap.cs
- ImageListUtils.cs
- DBCommand.cs
- HttpWriter.cs
- Configuration.cs
- XmlElementCollection.cs
- BeginCreateSecurityTokenRequest.cs
- ContentType.cs
- DecimalAverageAggregationOperator.cs
- TdsEnums.cs
- RadialGradientBrush.cs
- InProcStateClientManager.cs