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
- FamilyMapCollection.cs
- Point3DCollectionConverter.cs
- SelectionPattern.cs
- HScrollProperties.cs
- Window.cs
- SqlSelectStatement.cs
- XmlIlGenerator.cs
- LinqDataSourceInsertEventArgs.cs
- MobileControlBuilder.cs
- LinqDataSourceContextData.cs
- SafeNativeMethods.cs
- _CommandStream.cs
- WebContext.cs
- DependencyProperty.cs
- RuntimeEnvironment.cs
- PropertyChangedEventArgs.cs
- ColorDialog.cs
- WebUtil.cs
- LocalIdKeyIdentifierClause.cs
- Effect.cs
- CodeSnippetStatement.cs
- CqlQuery.cs
- regiisutil.cs
- ExtendedProtectionPolicy.cs
- SqlConnectionStringBuilder.cs
- ToolboxCategoryItems.cs
- CompressEmulationStream.cs
- ListContractAdapter.cs
- Native.cs
- JoinGraph.cs
- CrossSiteScriptingValidation.cs
- NewExpression.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- HandoffBehavior.cs
- DataGridViewCellStyleConverter.cs
- TypeSystem.cs
- SplineKeyFrames.cs
- DataBindingValueUIHandler.cs
- DbTransaction.cs
- EntityRecordInfo.cs
- RoutedEventValueSerializer.cs
- WeakReadOnlyCollection.cs
- WebEventCodes.cs
- DataGridViewImageCell.cs
- RegexMatchCollection.cs
- ThumbButtonInfoCollection.cs
- SHA512Managed.cs
- CalendarModeChangedEventArgs.cs
- LogReservationCollection.cs
- ImageProxy.cs
- MessageQueueTransaction.cs
- CodeDelegateInvokeExpression.cs
- ComNativeDescriptor.cs
- MappingModelBuildProvider.cs
- LinqDataSourceUpdateEventArgs.cs
- CapabilitiesUse.cs
- Column.cs
- EmissiveMaterial.cs
- Expression.cs
- ObjectStateManager.cs
- EdmType.cs
- CharacterHit.cs
- OracleNumber.cs
- OdbcRowUpdatingEvent.cs
- TransportSecurityProtocolFactory.cs
- CompensationExtension.cs
- FileDetails.cs
- ListBoxDesigner.cs
- ReadOnlyMetadataCollection.cs
- HttpResponseInternalWrapper.cs
- ProxyFragment.cs
- RemotingException.cs
- Vector3dCollection.cs
- WebBrowserEvent.cs
- HtmlImageAdapter.cs
- InvalidWMPVersionException.cs
- TargetInvocationException.cs
- ExtendedPropertyDescriptor.cs
- GlobalProxySelection.cs
- AtlasWeb.Designer.cs
- ParserExtension.cs
- WinEventQueueItem.cs
- EventSinkHelperWriter.cs
- RuntimeEnvironment.cs
- RegionData.cs
- smtpconnection.cs
- PolyBezierSegmentFigureLogic.cs
- CommunicationException.cs
- MasterPageParser.cs
- SpanIndex.cs
- MouseOverProperty.cs
- XmlChoiceIdentifierAttribute.cs
- Util.cs
- SafeNativeMethods.cs
- ProxyWebPartManager.cs
- TableRowGroup.cs
- InputLangChangeEvent.cs
- Highlights.cs
- IsolatedStoragePermission.cs
- DesignerWithHeader.cs