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
- UInt32Storage.cs
- OneOf.cs
- CookieProtection.cs
- PreservationFileWriter.cs
- TextBoxBaseDesigner.cs
- WorkerRequest.cs
- BooleanToVisibilityConverter.cs
- TextElementEnumerator.cs
- RecognizedPhrase.cs
- Tokenizer.cs
- PermissionAttributes.cs
- PageAsyncTaskManager.cs
- SqlDataSourceSelectingEventArgs.cs
- ProjectionNode.cs
- ControlPropertyNameConverter.cs
- SafeNativeMethodsOther.cs
- _BufferOffsetSize.cs
- PaintEvent.cs
- RemoveStoryboard.cs
- MetadataItem_Static.cs
- GridViewDeleteEventArgs.cs
- DtrList.cs
- BufferedWebEventProvider.cs
- DrawingVisualDrawingContext.cs
- SessionIDManager.cs
- TableCellCollection.cs
- PreservationFileWriter.cs
- QilGenerator.cs
- SessionEndingCancelEventArgs.cs
- XmlAttributes.cs
- MappingMetadataHelper.cs
- Compiler.cs
- PartDesigner.cs
- Membership.cs
- Int16Storage.cs
- DefaultObjectSerializer.cs
- MissingMethodException.cs
- CompositeScriptReferenceEventArgs.cs
- LineGeometry.cs
- DBSqlParserTable.cs
- TransformProviderWrapper.cs
- UIntPtr.cs
- ErasingStroke.cs
- DesignerTransactionCloseEvent.cs
- CustomActivityDesigner.cs
- ContentFilePart.cs
- DataSpaceManager.cs
- ApplicationServiceHelper.cs
- SmiEventSink.cs
- XsdCachingReader.cs
- RefreshEventArgs.cs
- FastPropertyAccessor.cs
- RewritingValidator.cs
- SafeNativeMethodsMilCoreApi.cs
- PeerToPeerException.cs
- VarRemapper.cs
- SortExpressionBuilder.cs
- VerticalAlignConverter.cs
- DefaultTextStoreTextComposition.cs
- GlyphInfoList.cs
- TextMessageEncodingBindingElement.cs
- DesignTableCollection.cs
- StreamUpdate.cs
- ResolveNameEventArgs.cs
- SqlFlattener.cs
- DefaultHttpHandler.cs
- SafeHandles.cs
- LicenseException.cs
- MetadataElement.cs
- ComboBoxRenderer.cs
- CommandEventArgs.cs
- QuadraticBezierSegment.cs
- NotifyParentPropertyAttribute.cs
- ProbeDuplex11AsyncResult.cs
- EntityClientCacheKey.cs
- LoginView.cs
- XmlILCommand.cs
- CookielessData.cs
- Scripts.cs
- ConfigurationSectionCollection.cs
- ResourcePool.cs
- SecureStringHasher.cs
- DocumentPageHost.cs
- CallSiteOps.cs
- GridViewSelectEventArgs.cs
- MailAddressCollection.cs
- RectangleHotSpot.cs
- ApplicationActivator.cs
- XmlSchemaGroupRef.cs
- CapabilitiesState.cs
- IconConverter.cs
- DataColumnMappingCollection.cs
- Visual3D.cs
- FixedDocument.cs
- X509UI.cs
- EmptyElement.cs
- StylusButtonCollection.cs
- ComponentConverter.cs
- GridViewAutomationPeer.cs
- ResXDataNode.cs