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
- ConstructorNeedsTagAttribute.cs
- NonDualMessageSecurityOverHttpElement.cs
- SID.cs
- StrokeDescriptor.cs
- NullableConverter.cs
- DictionaryTraceRecord.cs
- VirtualDirectoryMappingCollection.cs
- _LocalDataStore.cs
- XmlAnyElementAttributes.cs
- TextCollapsingProperties.cs
- UserControl.cs
- TextElementCollection.cs
- PageVisual.cs
- BitmapEditor.cs
- BooleanStorage.cs
- DetailsViewModeEventArgs.cs
- DataBinding.cs
- TTSEngineTypes.cs
- XmlChildEnumerator.cs
- CheckBoxFlatAdapter.cs
- StorageSetMapping.cs
- AnnotationService.cs
- XhtmlBasicListAdapter.cs
- ReversePositionQuery.cs
- DataGrid.cs
- NetworkInformationException.cs
- FileIOPermission.cs
- CodeAttributeDeclaration.cs
- NativeMethods.cs
- RequestCache.cs
- PackWebRequest.cs
- RNGCryptoServiceProvider.cs
- ConfigurationSchemaErrors.cs
- XmlSchemaComplexType.cs
- BevelBitmapEffect.cs
- ReferentialConstraintRoleElement.cs
- ActivityWithResultValueSerializer.cs
- TriggerAction.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- XmlSchemaCollection.cs
- BitmapMetadata.cs
- TraceInternal.cs
- AnimationClock.cs
- PipeConnection.cs
- ReliabilityContractAttribute.cs
- CopyAction.cs
- BitmapEffect.cs
- GraphicsContext.cs
- PersonalizationProviderCollection.cs
- SimpleFileLog.cs
- WebPart.cs
- AccessViolationException.cs
- ConfigXmlText.cs
- COM2IDispatchConverter.cs
- ChangeProcessor.cs
- FrameworkElementFactory.cs
- XmlSchemaSimpleContentExtension.cs
- basecomparevalidator.cs
- ParameterCollection.cs
- XmlSerializerVersionAttribute.cs
- PackageProperties.cs
- TargetParameterCountException.cs
- ToolZone.cs
- AVElementHelper.cs
- assertwrapper.cs
- ColorTranslator.cs
- LoginAutoFormat.cs
- CqlQuery.cs
- FileLoadException.cs
- HtmlLink.cs
- SerializationFieldInfo.cs
- OverlappedAsyncResult.cs
- XsltConvert.cs
- HtmlTableRow.cs
- Logging.cs
- SymLanguageType.cs
- RequestContextBase.cs
- Propagator.JoinPropagator.cs
- LexicalChunk.cs
- AutoScrollExpandMessageFilter.cs
- DataGridBoolColumn.cs
- loginstatus.cs
- TriggerCollection.cs
- DoubleAnimationClockResource.cs
- UDPClient.cs
- dataSvcMapFileLoader.cs
- FunctionUpdateCommand.cs
- PasswordPropertyTextAttribute.cs
- WebPartZoneCollection.cs
- CursorConverter.cs
- PageCache.cs
- MiniMapControl.xaml.cs
- GuidConverter.cs
- FontNamesConverter.cs
- AssemblyCache.cs
- TableDesigner.cs
- SectionRecord.cs
- XmlNotation.cs
- GenericIdentity.cs
- DeflateStream.cs