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
- DataTemplateKey.cs
- DefaultTextStoreTextComposition.cs
- DiscoveryProxy.cs
- XmlDictionaryReaderQuotas.cs
- RenameRuleObjectDialog.cs
- PropertyGeneratedEventArgs.cs
- _TLSstream.cs
- AspProxy.cs
- WindowsGrip.cs
- SpellerHighlightLayer.cs
- MemberCollection.cs
- TripleDES.cs
- StreamReader.cs
- Operator.cs
- CodeStatementCollection.cs
- ServiceBuildProvider.cs
- ServiceManagerHandle.cs
- ExtensibleClassFactory.cs
- DataGridViewCellCollection.cs
- MDIControlStrip.cs
- SymDocumentType.cs
- MailAddressCollection.cs
- WebServiceParameterData.cs
- RowToFieldTransformer.cs
- embossbitmapeffect.cs
- SqlProviderManifest.cs
- Variant.cs
- TransactionManager.cs
- _FtpDataStream.cs
- ProxyRpc.cs
- WinEventWrap.cs
- ReadOnlyPermissionSet.cs
- CodeBlockBuilder.cs
- _TimerThread.cs
- ExceptionHandler.cs
- ConfigurationSchemaErrors.cs
- ConditionedDesigner.cs
- MemberAssignment.cs
- CreateUserErrorEventArgs.cs
- FileDialogCustomPlacesCollection.cs
- JournalEntry.cs
- WebZone.cs
- MasterPage.cs
- WindowsToolbar.cs
- DefaultPrintController.cs
- DataSourceSelectArguments.cs
- ApplicationBuildProvider.cs
- XmlObjectSerializerContext.cs
- GroupedContextMenuStrip.cs
- IdentitySection.cs
- ListControl.cs
- ExceptionUtil.cs
- StylusShape.cs
- RelationshipFixer.cs
- Utils.cs
- SafeFileMappingHandle.cs
- TimeSpanSecondsConverter.cs
- Int16.cs
- DataGridItemEventArgs.cs
- ResourcesGenerator.cs
- ListControl.cs
- WindowsSysHeader.cs
- OleDbEnumerator.cs
- TrustManagerMoreInformation.cs
- basecomparevalidator.cs
- SessionStateContainer.cs
- TimerEventSubscription.cs
- PropertyStore.cs
- DbConnectionPoolCounters.cs
- QilStrConcat.cs
- WebPartHeaderCloseVerb.cs
- DBCommand.cs
- XmlSortKey.cs
- Directory.cs
- XmlSchemaSubstitutionGroup.cs
- IndexOutOfRangeException.cs
- XmlAnyElementAttributes.cs
- SortQuery.cs
- __ConsoleStream.cs
- Wildcard.cs
- UnmanagedMemoryStreamWrapper.cs
- FreezableCollection.cs
- ProtocolsConfigurationEntry.cs
- ReadOnlyDictionary.cs
- CommandEventArgs.cs
- _PooledStream.cs
- Bezier.cs
- QilCloneVisitor.cs
- HideDisabledControlAdapter.cs
- TypeReference.cs
- Span.cs
- SizeAnimationUsingKeyFrames.cs
- SByte.cs
- CellPartitioner.cs
- FlowLayoutPanelDesigner.cs
- DbException.cs
- AnnotationMap.cs
- AutomationElement.cs
- Util.cs
- UInt16Converter.cs