mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
102 lines
3.7 KiB
C#
102 lines
3.7 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace System.ServiceModel.Dispatcher
|
|
{
|
|
using System;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Channels;
|
|
|
|
public interface IInstanceContextProvider
|
|
{
|
|
InstanceContext GetExistingInstanceContext(Message message, IContextChannel channel);
|
|
void InitializeInstanceContext(InstanceContext instanceContext, Message message, IContextChannel channel);
|
|
bool IsIdle(InstanceContext instanceContext);
|
|
void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext);
|
|
}
|
|
|
|
internal abstract class InstanceContextProviderBase : IInstanceContextProvider
|
|
{
|
|
DispatchRuntime dispatchRuntime;
|
|
|
|
public DispatchRuntime DispatchRuntime
|
|
{
|
|
get
|
|
{
|
|
return this.dispatchRuntime;
|
|
}
|
|
}
|
|
|
|
internal InstanceContextProviderBase(DispatchRuntime dispatchRuntime)
|
|
{
|
|
this.dispatchRuntime = dispatchRuntime;
|
|
}
|
|
|
|
internal static bool IsProviderSingleton(IInstanceContextProvider provider)
|
|
{
|
|
return (provider is SingletonInstanceContextProvider);
|
|
}
|
|
|
|
internal static bool IsProviderSessionful(IInstanceContextProvider provider)
|
|
{
|
|
return (provider is PerSessionInstanceContextProvider);
|
|
}
|
|
|
|
internal static IInstanceContextProvider GetProviderForMode(InstanceContextMode instanceMode, DispatchRuntime runtime)
|
|
{
|
|
switch (instanceMode)
|
|
{
|
|
case InstanceContextMode.PerCall:
|
|
return new PerCallInstanceContextProvider(runtime);
|
|
case InstanceContextMode.PerSession:
|
|
return new PerSessionInstanceContextProvider(runtime);
|
|
case InstanceContextMode.Single:
|
|
return new SingletonInstanceContextProvider(runtime);
|
|
default:
|
|
DiagnosticUtility.FailFast("InstanceContextProviderBase.GetProviderForMode: default");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
internal static bool IsProviderPerCall(IInstanceContextProvider provider)
|
|
{
|
|
return (provider is PerCallInstanceContextProvider);
|
|
}
|
|
|
|
internal ServiceChannel GetServiceChannelFromProxy(IContextChannel channel)
|
|
{
|
|
ServiceChannel serviceChannel = channel as ServiceChannel;
|
|
if (serviceChannel == null)
|
|
{
|
|
serviceChannel = ServiceChannelFactory.GetServiceChannel(channel);
|
|
}
|
|
return serviceChannel;
|
|
}
|
|
|
|
#region IInstanceContextProvider Members
|
|
|
|
public virtual InstanceContext GetExistingInstanceContext(Message message, IContextChannel channel)
|
|
{
|
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
|
|
}
|
|
|
|
public virtual void InitializeInstanceContext(InstanceContext instanceContext, Message message, IContextChannel channel)
|
|
{
|
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
|
|
}
|
|
|
|
public virtual bool IsIdle(InstanceContext instanceContext)
|
|
{
|
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
|
|
}
|
|
|
|
public virtual void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext)
|
|
{
|
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|