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
- OdbcUtils.cs
- RadioButton.cs
- IntSecurity.cs
- Serializer.cs
- RouteParametersHelper.cs
- ImmutableObjectAttribute.cs
- ToolStripKeyboardHandlingService.cs
- WorkflowApplicationTerminatedException.cs
- ImageBrush.cs
- ContextConfiguration.cs
- MembershipUser.cs
- SelectionGlyphBase.cs
- MemoryFailPoint.cs
- ObjectStateManager.cs
- ManagementOperationWatcher.cs
- DataServiceBuildProvider.cs
- ContentPropertyAttribute.cs
- ItemCheckedEvent.cs
- NameValueFileSectionHandler.cs
- HtmlWindow.cs
- AtomicFile.cs
- OdbcConnectionPoolProviderInfo.cs
- DesignerSerializationVisibilityAttribute.cs
- DbCommandDefinition.cs
- FileDialog_Vista_Interop.cs
- AutomationPatternInfo.cs
- HttpPostClientProtocol.cs
- _PooledStream.cs
- DetailsViewInsertEventArgs.cs
- CommonObjectSecurity.cs
- SplineKeyFrames.cs
- WebControlAdapter.cs
- FormViewPageEventArgs.cs
- QilGeneratorEnv.cs
- InvokeMethodDesigner.xaml.cs
- AnonymousIdentificationModule.cs
- CheckBox.cs
- HandledMouseEvent.cs
- UnaryExpression.cs
- Vector3DValueSerializer.cs
- NeutralResourcesLanguageAttribute.cs
- latinshape.cs
- SecureEnvironment.cs
- PointAnimation.cs
- IndexOutOfRangeException.cs
- UdpUtility.cs
- AsymmetricSecurityBindingElement.cs
- IdnMapping.cs
- WorkflowOwnershipException.cs
- WS2007HttpBindingElement.cs
- SystemThemeKey.cs
- FrameworkElement.cs
- XmlAttributeHolder.cs
- ConsoleCancelEventArgs.cs
- Listbox.cs
- XmlJsonReader.cs
- ColorAnimation.cs
- HostVisual.cs
- TokenBasedSet.cs
- ADMembershipProvider.cs
- PassportIdentity.cs
- ObjectDataSourceDisposingEventArgs.cs
- IPAddressCollection.cs
- PathFigure.cs
- StreamGeometryContext.cs
- IntranetCredentialPolicy.cs
- EventData.cs
- XmlDataSource.cs
- EvidenceBase.cs
- MultipartContentParser.cs
- CodeIterationStatement.cs
- BookmarkUndoUnit.cs
- UncommonField.cs
- MappingModelBuildProvider.cs
- formatter.cs
- CodeMemberProperty.cs
- NotSupportedException.cs
- InputScopeNameConverter.cs
- LinkedList.cs
- CustomAttributeFormatException.cs
- MimeTypePropertyAttribute.cs
- TypeConverterHelper.cs
- DataTemplateKey.cs
- StatusBarPanel.cs
- SortedList.cs
- AtomEntry.cs
- ModuleConfigurationInfo.cs
- GenericTypeParameterConverter.cs
- ConfigXmlAttribute.cs
- Connector.xaml.cs
- TextEncodedRawTextWriter.cs
- ReadOnlyNameValueCollection.cs
- BaseTemplateCodeDomTreeGenerator.cs
- RegisteredScript.cs
- MembershipValidatePasswordEventArgs.cs
- FirstMatchCodeGroup.cs
- ILGenerator.cs
- CroppedBitmap.cs
- SpecialNameAttribute.cs
- TableDetailsCollection.cs