Esempio n. 1
0
        public bool Has(Type type)
        {
            bool hasType = _instanceCache.ContainsKey(type) || _typeMap.ContainsKey(type);

            if (!hasType && _parent != null)
            {
                hasType = _parent.Has(type);
            }

            return(hasType);
        }
Esempio n. 2
0
        IBaseCommand GetCommand(Type type)
        {
            Queue <IBaseCommand> cachedCommands;
            bool hasCached = _cache.TryGetValue(type, out cachedCommands) && cachedCommands.Count > 0;

            IBaseCommand command;

            if (hasCached)
            {
                command = cachedCommands.Dequeue();
            }
            else
            {
                if (!injector.Has(type))
                {
                    injector.Register(type, type, true);
                }

                command           = injector.Get <IBaseCommand>(type);
                command.onFinish += OnFinish;
            }

            return(command);
        }