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
- CustomErrorsSection.cs
- StylusDownEventArgs.cs
- CommonXSendMessage.cs
- ProviderConnectionPointCollection.cs
- AncestorChangedEventArgs.cs
- BindingList.cs
- MemberDomainMap.cs
- OperationCanceledException.cs
- HttpProcessUtility.cs
- SHA384.cs
- WebDescriptionAttribute.cs
- DbParameterHelper.cs
- NamespaceCollection.cs
- CharacterBufferReference.cs
- ChannelManager.cs
- PreloadHost.cs
- UniqueEventHelper.cs
- InternalTypeHelper.cs
- TransactionCache.cs
- CodeValidator.cs
- CompilerGeneratedAttribute.cs
- CodeIterationStatement.cs
- EntityDataSourceStatementEditor.cs
- SqlNodeAnnotations.cs
- ButtonField.cs
- DataTrigger.cs
- XmlLoader.cs
- ObjectMemberMapping.cs
- SymbolResolver.cs
- HttpCacheVary.cs
- EngineSiteSapi.cs
- RadioButtonDesigner.cs
- IdentitySection.cs
- DynamicMetaObjectBinder.cs
- HorizontalAlignConverter.cs
- ActivityExecutorDelegateInfo.cs
- UnionQueryOperator.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- TlsSspiNegotiation.cs
- DataGridViewRowCancelEventArgs.cs
- HtmlHead.cs
- NumberFormatInfo.cs
- RootBuilder.cs
- StorageTypeMapping.cs
- Collection.cs
- MatrixStack.cs
- PropertyCollection.cs
- CorrelationKey.cs
- ValidationPropertyAttribute.cs
- MetaForeignKeyColumn.cs
- XmlSchemaValidator.cs
- DataGridViewRowPostPaintEventArgs.cs
- CharUnicodeInfo.cs
- DSASignatureDeformatter.cs
- TemplateParser.cs
- KnownTypes.cs
- TcpClientSocketManager.cs
- TraceContext.cs
- LinkArea.cs
- SettingsProviderCollection.cs
- DataBinder.cs
- DesignColumnCollection.cs
- TextPointerBase.cs
- XmlSchemaDatatype.cs
- IncrementalHitTester.cs
- HTTPNotFoundHandler.cs
- ParameterModifier.cs
- EncodingNLS.cs
- FlowDocumentView.cs
- _OverlappedAsyncResult.cs
- MiniParameterInfo.cs
- QuadraticEase.cs
- XPathChildIterator.cs
- ListView.cs
- SqlUtils.cs
- SamlSecurityTokenAuthenticator.cs
- StylusPointProperties.cs
- SchemaImporter.cs
- MultipartIdentifier.cs
- RoleManagerModule.cs
- DataRow.cs
- MultiBinding.cs
- AutoResizedEvent.cs
- EntityDataSourceContainerNameConverter.cs
- dtdvalidator.cs
- SqlDataReader.cs
- DesignTimeVisibleAttribute.cs
- GB18030Encoding.cs
- TypeForwardedToAttribute.cs
- PageParserFilter.cs
- QilStrConcat.cs
- HelloOperationAsyncResult.cs
- IDReferencePropertyAttribute.cs
- Sequence.cs
- BitmapEffectrendercontext.cs
- TypedElement.cs
- CannotUnloadAppDomainException.cs
- NameValueSectionHandler.cs
- PropertyConverter.cs
- AstTree.cs