Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / OutputChannel.cs / 1 / OutputChannel.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; using System.ServiceModel; using System.Diagnostics; using System.ServiceModel.Diagnostics; abstract class OutputChannel : ChannelBase, IOutputChannel { protected OutputChannel(ChannelManagerBase manager) : base(manager) { } public abstract EndpointAddress RemoteAddress { get; } public abstract Uri Via { get; } public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state) { return this.BeginSend(message, this.DefaultSendTimeout, callback, state); } public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) { if (message == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); if (timeout < TimeSpan.Zero) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("timeout", timeout, SR.GetString(SR.SFxTimeoutOutOfRange0))); ThrowIfDisposedOrNotOpen(); AddHeadersTo(message); this.EmitTrace(message); return OnBeginSend(message, timeout, callback, state); } public void EndSend(IAsyncResult result) { OnEndSend(result); } public override T GetProperty() { if (typeof(T) == typeof(IOutputChannel)) { return (T)(object)this; } T baseProperty = base.GetProperty (); if (baseProperty != null) { return baseProperty; } return default(T); } protected abstract void OnSend(Message message, TimeSpan timeout); protected abstract IAsyncResult OnBeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state); protected abstract void OnEndSend(IAsyncResult result); public void Send(Message message) { this.Send(message, this.DefaultSendTimeout); } public void Send(Message message, TimeSpan timeout) { if (message == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); if (timeout < TimeSpan.Zero) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("timeout", timeout, SR.GetString(SR.SFxTimeoutOutOfRange0))); ThrowIfDisposedOrNotOpen(); AddHeadersTo(message); this.EmitTrace(message); OnSend(message, timeout); } protected virtual TraceRecord CreateSendTrace(Message message) { return MessageTransmitTraceRecord.CreateSendTraceRecord(message, this.RemoteAddress); } void EmitTrace(Message message) { if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.MessageSent, this.CreateSendTrace(message), this, null); } } protected virtual void AddHeadersTo(Message message) { } } } // 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
- Deserializer.cs
- ToolZone.cs
- MenuAdapter.cs
- ToolStripDropDownClosedEventArgs.cs
- PackagePartCollection.cs
- Transactions.cs
- BitmapEffect.cs
- SchemaElementDecl.cs
- ClonableStack.cs
- LayoutTable.cs
- MethodResolver.cs
- SocketPermission.cs
- DatatypeImplementation.cs
- DocumentScope.cs
- HtmlEmptyTagControlBuilder.cs
- CodeFieldReferenceExpression.cs
- PropertyTab.cs
- DataGridViewAutoSizeModeEventArgs.cs
- sqlnorm.cs
- CodeCastExpression.cs
- RoleGroupCollection.cs
- EmbeddedMailObjectsCollection.cs
- XmlRootAttribute.cs
- SamlAuthenticationClaimResource.cs
- AnimatedTypeHelpers.cs
- ExponentialEase.cs
- ProxyGenerationError.cs
- Int32AnimationBase.cs
- SamlConditions.cs
- ReadOnlyHierarchicalDataSourceView.cs
- Int64KeyFrameCollection.cs
- DecimalSumAggregationOperator.cs
- FixedSOMPageElement.cs
- SqlBuffer.cs
- SqlCacheDependencyDatabase.cs
- LineBreak.cs
- EntityContainerAssociationSet.cs
- ClassicBorderDecorator.cs
- RuntimeConfig.cs
- DataServiceHost.cs
- ReversePositionQuery.cs
- TrackingServices.cs
- VirtualizedItemPattern.cs
- QuaternionKeyFrameCollection.cs
- StorageMappingItemCollection.cs
- DataGridViewColumn.cs
- HostingEnvironmentSection.cs
- Gdiplus.cs
- AddingNewEventArgs.cs
- TextComposition.cs
- HttpRequestCacheValidator.cs
- ToolboxComponentsCreatingEventArgs.cs
- PersonalizationAdministration.cs
- RestHandlerFactory.cs
- ReliabilityContractAttribute.cs
- AllowedAudienceUriElement.cs
- TransformPattern.cs
- _BaseOverlappedAsyncResult.cs
- Point3DCollectionValueSerializer.cs
- ManipulationLogic.cs
- SynchronizedDispatch.cs
- HashStream.cs
- SchemaElement.cs
- SmiMetaDataProperty.cs
- DbMetaDataFactory.cs
- TextBox.cs
- HostedImpersonationContext.cs
- GifBitmapEncoder.cs
- ImageCodecInfo.cs
- ThousandthOfEmRealPoints.cs
- RowCache.cs
- DocumentGrid.cs
- XmlIterators.cs
- AppDomainAttributes.cs
- ByteStreamMessage.cs
- SecurityTraceRecordHelper.cs
- PageCache.cs
- RelationshipConverter.cs
- CaseInsensitiveOrdinalStringComparer.cs
- TraversalRequest.cs
- SiteOfOriginPart.cs
- CustomErrorCollection.cs
- ViewStateChangedEventArgs.cs
- ISO2022Encoding.cs
- MetadataCache.cs
- SqlFileStream.cs
- httpserverutility.cs
- TextDecoration.cs
- PixelFormat.cs
- DataGridViewRowCancelEventArgs.cs
- SimplePropertyEntry.cs
- XmlSchemaDocumentation.cs
- ServiceDescriptionContext.cs
- HtmlForm.cs
- Clause.cs
- XmlSchemaInfo.cs
- BitVector32.cs
- SymbolMethod.cs
- Vector3DAnimationBase.cs
- WebPartVerbCollection.cs