Example #1
0
        private bool TryAllInstancesFromServiceLocators <T>(out ICollection <T> instance) where T : class
        {
            IEnumerable <T> result;

            if (UserServiceLocator != null)
            {
                result = UserServiceLocator.GetAllInstances <T>();
                if (result != null)
                {
                    instance = result as IList <T>;
                    return(true);
                }
            }

            if (ProviderServiceLocator != null)
            {
                result = ProviderServiceLocator.GetAllInstances <T>();
                if (result != null)
                {
                    instance = result as IList <T>;
                    return(true);
                }
            }

            instance = null;
            return(false);
        }