//protected virtual CompositeInstanceImpl CreateNewCopy( IEnumerable<Type> publicCompositeTypes, UsesContainerQuery uses )
        //{
        //   return new CompositeInstanceImpl( this._structureOwner, this._modelInfo.Model, publicCompositeTypes, uses );
        //}

        protected InstancePoolInfo <TInvocation> FindPool <TInvocation>(Type key, DictionaryQuery <Type, InstancePoolInfo <TInvocation> > dic)
        {
            InstancePoolInfo <TInvocation> pool = null;

            if (!dic.TryFindInTypeDictionarySearchSubTypes(key, out pool))
            {
                throw new InternalException("Could not find invocation base type " + key + ".");
            }
            return(pool);
        }
        protected TInvocation CreateInvocationBase <TInvocation>(DictionaryQuery <Type, InstancePoolInfo <TInvocation> > dic, Type key)
        {
            InstancePoolInfo <TInvocation> pool = this.FindPool <TInvocation>(key, dic);
            TInvocation result;

            if (!pool.Pool.TryTake(out result))
            {
                result = (TInvocation)this._modelInfo.Types.CompositeFactory.CreateInstance(pool.TypeGenerationResult.GeneratedTypeID, this._gArgs, new Object[] { this });
            }
            return(result);
        }