mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* ServiceHostBase.cs : in AddBaseAddress(), use base_addresses instead of Description. It could be called in InitializeDescription. * InstanceBehavior.cs : allow nonpublic instance. * DefaultOperationInvoker.cs : do use IsSynchronous correctly. svn path=/trunk/mcs/; revision=147774
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Dispatcher;
|
|
using System.ServiceModel.Channels;
|
|
using System.Text;
|
|
|
|
namespace System.ServiceModel.Dispatcher
|
|
{
|
|
internal class InstanceBehavior
|
|
{
|
|
DispatchRuntime dispatch_runtime;
|
|
|
|
internal InstanceBehavior (DispatchRuntime runtime) {
|
|
dispatch_runtime = runtime;
|
|
}
|
|
|
|
internal void Initialize (InstanceContext iCtx) {
|
|
Message message = OperationContext.Current.IncomingMessage;
|
|
IContextChannel channel = OperationContext.Current.Channel;
|
|
if (dispatch_runtime.InstanceContextProvider != null) {
|
|
dispatch_runtime.InstanceContextProvider.InitializeInstanceContext (iCtx,
|
|
message,
|
|
channel);
|
|
}
|
|
foreach (IInstanceContextInitializer init in dispatch_runtime.InstanceContextInitializers)
|
|
init.Initialize (iCtx, message);
|
|
}
|
|
|
|
internal object GetServiceInstance (InstanceContext ctx, Message m, ref bool createdByUserProvider) {
|
|
if (dispatch_runtime.InstanceProvider != null) {
|
|
createdByUserProvider = true;
|
|
return dispatch_runtime.InstanceProvider.GetInstance (ctx, m);
|
|
}
|
|
createdByUserProvider = false;
|
|
return Activator.CreateInstance (
|
|
dispatch_runtime.ChannelDispatcher.Host.Description.ServiceType, true);
|
|
}
|
|
|
|
internal IInstanceContextProvider InstanceContextProvider {
|
|
get {
|
|
return dispatch_runtime.InstanceContextProvider;
|
|
}
|
|
}
|
|
|
|
internal void ReleaseServiceInstance (InstanceContext ctx, object impl)
|
|
{
|
|
if (ctx.IsUserProvidedInstance) {
|
|
dispatch_runtime.InstanceProvider.ReleaseInstance (ctx, impl);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|