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
- MailDefinition.cs
- DbParameterCollectionHelper.cs
- PrimitiveSchema.cs
- ListViewUpdateEventArgs.cs
- TextDecorations.cs
- ActivityBindForm.Designer.cs
- SourceSwitch.cs
- PageCatalogPart.cs
- PointAnimationBase.cs
- SettingsPropertyCollection.cs
- RecognizeCompletedEventArgs.cs
- MailMessageEventArgs.cs
- DesignerActionMethodItem.cs
- RefExpr.cs
- VoiceInfo.cs
- ConfigXmlComment.cs
- ItemChangedEventArgs.cs
- StructuralComparisons.cs
- StringUtil.cs
- CryptoHandle.cs
- XXXOnTypeBuilderInstantiation.cs
- FacetValueContainer.cs
- XmlQueryRuntime.cs
- ToolboxItemSnapLineBehavior.cs
- AssociationEndMember.cs
- InvalidateEvent.cs
- TabPanel.cs
- CanonicalXml.cs
- IndexerNameAttribute.cs
- WebSysDescriptionAttribute.cs
- VerificationException.cs
- NullableFloatMinMaxAggregationOperator.cs
- TryExpression.cs
- StyleXamlParser.cs
- TextRangeEditTables.cs
- ImageConverter.cs
- ValidationPropertyAttribute.cs
- DocumentSignatureManager.cs
- EmptyStringExpandableObjectConverter.cs
- TextSimpleMarkerProperties.cs
- TileBrush.cs
- UserControlCodeDomTreeGenerator.cs
- ReadOnlyDataSourceView.cs
- RpcResponse.cs
- BamlTreeMap.cs
- SchemaElementDecl.cs
- TextTreeInsertUndoUnit.cs
- SemanticBasicElement.cs
- ModelMemberCollection.cs
- CommandManager.cs
- ReadWriteObjectLock.cs
- EntityKey.cs
- SqlReferenceCollection.cs
- WebPartConnectionsCancelEventArgs.cs
- ReachSerializationUtils.cs
- ToolStripDropDown.cs
- TextBoxDesigner.cs
- FieldMetadata.cs
- NamespaceCollection.cs
- Quaternion.cs
- AgileSafeNativeMemoryHandle.cs
- TextEncodedRawTextWriter.cs
- EUCJPEncoding.cs
- QuaternionIndependentAnimationStorage.cs
- UpdatePanel.cs
- TextContainer.cs
- CopyAction.cs
- OdbcDataAdapter.cs
- XmlILCommand.cs
- RuleValidation.cs
- SmiEventSink_Default.cs
- XmlHierarchyData.cs
- _NTAuthentication.cs
- Visitors.cs
- AspCompat.cs
- UTF32Encoding.cs
- ScrollProviderWrapper.cs
- TypeValidationEventArgs.cs
- NameTable.cs
- EntityTypeBase.cs
- Buffer.cs
- BinaryFormatterWriter.cs
- PointCollection.cs
- PersonalizationStateQuery.cs
- LinkLabelLinkClickedEvent.cs
- LinqDataSourceSelectEventArgs.cs
- ShaderEffect.cs
- ThreadExceptionDialog.cs
- Bitmap.cs
- EUCJPEncoding.cs
- ObjectListFieldCollection.cs
- ByteAnimationUsingKeyFrames.cs
- ModuleBuilderData.cs
- InstanceKeyCollisionException.cs
- HtmlAnchor.cs
- StylusButtonCollection.cs
- PenLineJoinValidation.cs
- ReadOnlyMetadataCollection.cs
- AutomationIdentifier.cs
- FormatterConverter.cs