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
- WindowsAuthenticationModule.cs
- RecordManager.cs
- ProxyManager.cs
- GradientStop.cs
- MembershipUser.cs
- ExternalFile.cs
- DefaultIfEmptyQueryOperator.cs
- KeyboardEventArgs.cs
- XmlSchemaSimpleTypeRestriction.cs
- Comparer.cs
- StrokeNode.cs
- FixedElement.cs
- __TransparentProxy.cs
- DebugInfoExpression.cs
- CodeSnippetCompileUnit.cs
- WebPartTransformerCollection.cs
- ITreeGenerator.cs
- WSFederationHttpSecurity.cs
- DataPagerFieldCollection.cs
- WindowsListViewGroup.cs
- CommandDevice.cs
- WebPartTracker.cs
- UnSafeCharBuffer.cs
- EntityDataSourceDataSelectionPanel.cs
- ConfigurationElementProperty.cs
- DecoderFallbackWithFailureFlag.cs
- ErrorsHelper.cs
- EntitySetDataBindingList.cs
- RangeValidator.cs
- DynamicObjectAccessor.cs
- ExpandableObjectConverter.cs
- ThrowHelper.cs
- CompressEmulationStream.cs
- GenerateTemporaryTargetAssembly.cs
- ExclusiveHandle.cs
- _Semaphore.cs
- MatrixTransform3D.cs
- DoubleLink.cs
- AssemblyCacheEntry.cs
- XPathSelectionIterator.cs
- PathFigureCollection.cs
- UnsafeNativeMethods.cs
- TreeViewBindingsEditorForm.cs
- ResumeStoryboard.cs
- TransformFinalBlockRequest.cs
- UnsafeNetInfoNativeMethods.cs
- SqlInternalConnectionTds.cs
- SettingsPropertyIsReadOnlyException.cs
- LinqDataSource.cs
- ContainerUIElement3D.cs
- AffineTransform3D.cs
- SafeRightsManagementPubHandle.cs
- parserscommon.cs
- TreeIterator.cs
- SurrogateChar.cs
- BaseTemplateCodeDomTreeGenerator.cs
- AvTraceDetails.cs
- TraceLog.cs
- EventDescriptorCollection.cs
- VersionedStreamOwner.cs
- BufferModeSettings.cs
- TextTreeNode.cs
- ChannelSinkStacks.cs
- HttpHeaderCollection.cs
- StagingAreaInputItem.cs
- CDSsyncETWBCLProvider.cs
- WSSecureConversationDec2005.cs
- SmtpFailedRecipientsException.cs
- Wizard.cs
- PrefixQName.cs
- BindingNavigator.cs
- PagedDataSource.cs
- StringInfo.cs
- HtmlInputCheckBox.cs
- BlurBitmapEffect.cs
- ToolStripDropDownMenu.cs
- odbcmetadatacolumnnames.cs
- FormParameter.cs
- metadatamappinghashervisitor.cs
- ApplicationProxyInternal.cs
- SchemaMapping.cs
- CustomErrorsSection.cs
- PrivilegeNotHeldException.cs
- SmtpFailedRecipientException.cs
- MenuItemStyleCollection.cs
- XmlConvert.cs
- ControlCachePolicy.cs
- Stack.cs
- XmlRootAttribute.cs
- CompiledQuery.cs
- DefaultValueAttribute.cs
- ServerIdentity.cs
- EmptyReadOnlyDictionaryInternal.cs
- HelpPage.cs
- ThreadSafeList.cs
- EpmTargetPathSegment.cs
- WebPartAuthorizationEventArgs.cs
- QuestionEventArgs.cs
- DynamicILGenerator.cs
- Normalization.cs