Esempio n. 1
0
        /// <inheritdoc />
        public object Resolve(Type type, params object[] arguments)
        {
            ContainerInstance instance = this.Get(type);

            if (instance != null)
            {
                return(instance.Resolve(arguments));
            }

            if (this.Behavior.AutoRegistration)
            {
                if (this.parentContainer == null || !this.parentContainer.IsRegistered(type))
                {
                    using (var registration = this.Registration())
                    {
                        instance = (ContainerInstance)registration.Register(type);
                    }

                    return(instance.Resolve(arguments));
                }
            }

            if (this.parentContainer != null)
            {
                return(this.parentContainer.Resolve(type, arguments));
            }

            throw new ArgumentOutOfRangeException(
                      "type",
                      string.Format(CultureInfo.CurrentCulture, InversionOfControlResources.ErrMsg_TypeIsNotRegistered, type));
        }