Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / PerSessionInstanceContextProvider.cs / 1 / PerSessionInstanceContextProvider.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System; using System.ServiceModel; using System.ServiceModel.Channels; internal class PerSessionInstanceContextProvider : InstanceContextProviderBase { internal PerSessionInstanceContextProvider(DispatchRuntime dispatchRuntime) : base(dispatchRuntime) { } #region IInstanceContextProvider Members public override InstanceContext GetExistingInstanceContext(Message message, IContextChannel channel) { // Here is the flow for a Sessionful channel // 1. First request comes in on new channel. // 2. ServiceChannel.InstanceContext is returned which is null. // 3. InstanceBehavior.EnsureInstanceContext will create a new InstanceContext. // 4. this.InitializeInstanceContext is called with the newly created InstanceContext and the channel. // 5. If the channel is sessionful then its bound to the InstanceContext. // 6. Bind channel to the InstanceContext. // 7. For all further requests on the same channel, we will return ServiceChannel.InstanceContext which will be non null. ServiceChannel serviceChannel = this.GetServiceChannelFromProxy(channel); DiagnosticUtility.DebugAssert((serviceChannel != null), "System.ServiceModel.Dispatcher.PerSessionInstanceContextProvider.GetExistingInstanceContext(), serviceChannel != null"); return (serviceChannel != null) ? serviceChannel.InstanceContext : null; } public override void InitializeInstanceContext(InstanceContext instanceContext, Message message, IContextChannel channel) { ServiceChannel serviceChannel = GetServiceChannelFromProxy(channel); if (serviceChannel != null && serviceChannel.HasSession) { instanceContext.BindIncomingChannel(serviceChannel); } } public override bool IsIdle(InstanceContext instanceContext) { //By default return true return true; } public override void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { //no-op } #endregion } } // 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
- BitmapEffect.cs
- DataServiceClientException.cs
- SymbolType.cs
- InvalidEnumArgumentException.cs
- ListBoxItem.cs
- DragCompletedEventArgs.cs
- HitTestParameters.cs
- PropertyGridEditorPart.cs
- SystemColorTracker.cs
- DataSourceHelper.cs
- ChangeInterceptorAttribute.cs
- SettingsPropertyValueCollection.cs
- NamedPermissionSet.cs
- Transform3D.cs
- MaskedTextProvider.cs
- ScrollViewerAutomationPeer.cs
- XmlBinaryReader.cs
- Executor.cs
- AuthenticationSection.cs
- String.cs
- CallTemplateAction.cs
- FtpWebResponse.cs
- EqualityComparer.cs
- Latin1Encoding.cs
- FormsAuthenticationEventArgs.cs
- PrinterSettings.cs
- DocobjHost.cs
- Point3DCollection.cs
- PerformanceCounter.cs
- Process.cs
- WebControlParameterProxy.cs
- Encoding.cs
- RSACryptoServiceProvider.cs
- DbParameterCollection.cs
- _StreamFramer.cs
- ContentElement.cs
- DesignerProperties.cs
- HttpCachePolicy.cs
- ListDictionary.cs
- DateTimeFormatInfo.cs
- TransformedBitmap.cs
- XpsFont.cs
- CommonDialog.cs
- LightweightCodeGenerator.cs
- WinFormsSpinner.cs
- SemanticResultValue.cs
- ThreadSafeMessageFilterTable.cs
- CatalogPartCollection.cs
- AssociationSetEnd.cs
- TextCollapsingProperties.cs
- ApplicationServiceHelper.cs
- CategoryAttribute.cs
- ConnectionStringsExpressionBuilder.cs
- UInt64Storage.cs
- ConfigurationValue.cs
- SerializationException.cs
- StoreItemCollection.Loader.cs
- MediaElement.cs
- AppSettingsExpressionEditor.cs
- ToolStripItemCollection.cs
- Crypto.cs
- ObjectDataSourceFilteringEventArgs.cs
- GacUtil.cs
- Int32Storage.cs
- AmbientValueAttribute.cs
- WorkflowViewStateService.cs
- MimeParameters.cs
- xsdvalidator.cs
- Win32SafeHandles.cs
- ListBox.cs
- UriTemplateClientFormatter.cs
- Matrix.cs
- PeerPresenceInfo.cs
- Brush.cs
- CompiledQuery.cs
- BooleanToVisibilityConverter.cs
- DrawingBrush.cs
- UICuesEvent.cs
- RegularExpressionValidator.cs
- CurrentTimeZone.cs
- DocumentSequence.cs
- XmlProcessingInstruction.cs
- UInt16.cs
- SafeArrayRankMismatchException.cs
- EventLogPermission.cs
- PerformanceCounterPermissionAttribute.cs
- ArrayConverter.cs
- StandardOleMarshalObject.cs
- AppendHelper.cs
- CodeMemberEvent.cs
- BindableAttribute.cs
- UpDownEvent.cs
- ListMarkerLine.cs
- InputReport.cs
- DetailsViewCommandEventArgs.cs
- ImageListStreamer.cs
- AncillaryOps.cs
- EventItfInfo.cs
- ActivityMarkupSerializer.cs
- LinkedResourceCollection.cs