Ejemplo n.º 1
0
        internal bool CanUnload(InstanceContext instanceContext)
        {
            if (InstanceContextProviderBase.IsProviderSingleton(this.instanceContextProvider))
            {
                return(false);
            }

            if (InstanceContextProviderBase.IsProviderPerCall(this.instanceContextProvider) ||
                InstanceContextProviderBase.IsProviderSessionful(this.instanceContextProvider))
            {
                return(true);
            }

            //User provided InstanceContextProvider. Call the provider to check for idle.
            if (!this.instanceContextProvider.IsIdle(instanceContext))
            {
                this.instanceContextProvider.NotifyIdle(InstanceContext.NotifyIdleCallback, instanceContext);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private void TransferChannelFromPendingList(ref MessageRpc rpc)
        {
            if (rpc.Channel.IsPending)
            {
                rpc.Channel.IsPending = false;

                ChannelDispatcher        channelDispatcher = rpc.Channel.ChannelDispatcher;
                IInstanceContextProvider provider          = _instance.InstanceContextProvider;

                if (!InstanceContextProviderBase.IsProviderSessionful(provider) &&
                    !InstanceContextProviderBase.IsProviderSingleton(provider))
                {
                    IChannel proxy = rpc.Channel.Proxy as IChannel;
                    if (!rpc.InstanceContext.IncomingChannels.Contains(proxy))
                    {
                        channelDispatcher.Channels.Add(proxy);
                    }
                }

                channelDispatcher.PendingChannels.Remove(rpc.Channel.Binder.Channel);
            }
        }
 internal bool CanUnload(InstanceContext instanceContext)
 {
     if (InstanceContextProviderBase.IsProviderSingleton(this.instanceContextProvider))
     {
         return(false);
     }
     if ((!InstanceContextProviderBase.IsProviderPerCall(this.instanceContextProvider) && !InstanceContextProviderBase.IsProviderSessionful(this.instanceContextProvider)) && !this.instanceContextProvider.IsIdle(instanceContext))
     {
         this.instanceContextProvider.NotifyIdle(InstanceContext.NotifyIdleCallback, instanceContext);
         return(false);
     }
     return(true);
 }