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);
 }
Esempio n. 2
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);
        }