Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / InputChannelBinder.cs / 1 / InputChannelBinder.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Dispatcher
{
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Diagnostics;
class InputChannelBinder : IChannelBinder
{
IInputChannel channel;
Uri listenUri;
internal InputChannelBinder(IInputChannel channel, Uri listenUri)
{
if (!((channel != null)))
{
DiagnosticUtility.DebugAssert("InputChannelBinder.InputChannelBinder: (channel != null)");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channel");
}
this.channel = channel;
this.listenUri = listenUri;
}
public IChannel Channel
{
get { return this.channel; }
}
public bool HasSession
{
get { return this.channel is ISessionChannel; }
}
public Uri ListenUri
{
get { return this.listenUri; }
}
public EndpointAddress LocalAddress
{
get { return this.channel.LocalAddress; }
}
public EndpointAddress RemoteAddress
{
get
{
#pragma warning suppress 56503 // [....], the property is really not implemented, cannot lie, API not public
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
}
}
public void Abort()
{
this.channel.Abort();
}
public void CloseAfterFault(TimeSpan timeout)
{
this.channel.Close(timeout);
}
public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
{
return this.channel.BeginTryReceive(timeout, callback, state);
}
public bool EndTryReceive(IAsyncResult result, out RequestContext requestContext)
{
Message message;
if (this.channel.EndTryReceive(result, out message))
{
requestContext = this.WrapMessage(message);
return true;
}
else
{
requestContext = null;
return false;
}
}
public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
}
public void EndSend(IAsyncResult result)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
}
public void Send(Message message, TimeSpan timeout)
{
throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
}
public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
{
Message message;
if (this.channel.TryReceive(timeout, out message))
{
requestContext = this.WrapMessage(message);
return true;
}
else
{
requestContext = null;
return false;
}
}
public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
}
public Message EndRequest(IAsyncResult result)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
}
public Message Request(Message message, TimeSpan timeout)
{
throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
}
public bool WaitForMessage(TimeSpan timeout)
{
return this.channel.WaitForMessage(timeout);
}
public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
{
return this.channel.BeginWaitForMessage(timeout, callback, state);
}
public bool EndWaitForMessage(IAsyncResult result)
{
return this.channel.EndWaitForMessage(result);
}
RequestContext WrapMessage(Message message)
{
if (message == null)
{
return null;
}
else
{
return new InputRequestContext(message, this);
}
}
class InputRequestContext : RequestContextBase
{
InputChannelBinder binder;
internal InputRequestContext(Message request, InputChannelBinder binder)
: base(request, TimeSpan.Zero, TimeSpan.Zero)
{
this.binder = binder;
}
protected override void OnAbort()
{
}
protected override void OnClose(TimeSpan timeout)
{
}
protected override void OnReply(Message message, TimeSpan timeout)
{
}
protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
return new CompletedAsyncResult(callback, state);
}
protected override void OnEndReply(IAsyncResult result)
{
CompletedAsyncResult.End(result);
}
}
}
}
// 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
- SemanticKeyElement.cs
- SessionSwitchEventArgs.cs
- GradientSpreadMethodValidation.cs
- CollectionBuilder.cs
- QilBinary.cs
- DecimalAnimationUsingKeyFrames.cs
- BamlTreeNode.cs
- AnnotationResource.cs
- SchemaObjectWriter.cs
- FixedSOMContainer.cs
- WebConfigurationHostFileChange.cs
- RadioButton.cs
- SqlDeflator.cs
- WinInet.cs
- XmlNodeReader.cs
- StoryFragments.cs
- MetricEntry.cs
- TimeZoneInfo.cs
- PageHandlerFactory.cs
- CodeEntryPointMethod.cs
- iisPickupDirectory.cs
- PowerModeChangedEventArgs.cs
- BaseCollection.cs
- FolderBrowserDialog.cs
- login.cs
- GridEntry.cs
- DataTemplateSelector.cs
- GridViewUpdatedEventArgs.cs
- OnOperation.cs
- IteratorFilter.cs
- DbConnectionPool.cs
- XmlSortKeyAccumulator.cs
- CmsInterop.cs
- httpserverutility.cs
- HtmlElementEventArgs.cs
- IWorkflowDebuggerService.cs
- DataServicePagingProviderWrapper.cs
- LayoutEditorPart.cs
- ForeignKeyFactory.cs
- FontConverter.cs
- X509DefaultServiceCertificateElement.cs
- ReadOnlyPropertyMetadata.cs
- InternalsVisibleToAttribute.cs
- WCFBuildProvider.cs
- XmlReaderSettings.cs
- HtmlTableRowCollection.cs
- RenderCapability.cs
- InstanceValue.cs
- DialogResultConverter.cs
- ToolBar.cs
- WebPartMenuStyle.cs
- TypeForwardedToAttribute.cs
- RelationshipEndMember.cs
- ConfigurationStrings.cs
- PackageFilter.cs
- BuildManagerHost.cs
- FunctionDefinition.cs
- PrimaryKeyTypeConverter.cs
- LabelLiteral.cs
- CodeSubDirectory.cs
- DropShadowEffect.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- HyperLinkField.cs
- WebPartConnectVerb.cs
- RegexCapture.cs
- ThemeInfoAttribute.cs
- NetworkInterface.cs
- CodeSnippetTypeMember.cs
- ToolStripItemRenderEventArgs.cs
- CounterSetInstance.cs
- StringUtil.cs
- RuntimeConfigLKG.cs
- DataMemberFieldConverter.cs
- RoleServiceManager.cs
- ThicknessAnimationBase.cs
- ReturnValue.cs
- DrawingAttributes.cs
- GeometryModel3D.cs
- WebPartChrome.cs
- Int16AnimationBase.cs
- ComponentChangingEvent.cs
- VirtualPathData.cs
- ExtractCollection.cs
- FrameworkObject.cs
- CodeGeneratorOptions.cs
- RemotingAttributes.cs
- precedingquery.cs
- HtmlFormParameterReader.cs
- ImageClickEventArgs.cs
- FileAuthorizationModule.cs
- DataSourceXmlClassAttribute.cs
- SystemFonts.cs
- PackageDigitalSignatureManager.cs
- PartialCachingControl.cs
- TrackingDataItem.cs
- CodeDirectoryCompiler.cs
- SecurityListenerSettingsLifetimeManager.cs
- Soap.cs
- BamlMapTable.cs
- LinqExpressionNormalizer.cs